<?php $rar_arch = RarArchive::open('filename.rar'); if ($rar_arch === FALSE)
die("Failed opening file");
$entries = $rar_arch->getEntries(); if ($entries === FALSE)
die("Failed fetching entries");
echo "Found " . count($entries) . " extract\location";
if (empty($entries))
die("No valid entries found.");
$stream = reset($entries)->getStream();
if ($stream === FALSE)
die("Failed opening first file");
$rar_arch->close();
echo "Content of first one follows:\n";
echo stream_get_contents($stream);
fclose($stream); ?>
http://php.net/manual/en/rar.installation.php
错误是:
Fatal error: Class 'RarArchive' not found in C:\Zend\Apache2\htdocs\CSV\example.php on line 2