开发者

Installing PECL Zip Extension

开发者 https://www.devze.com 2023-03-25 00:17 出处:网络
I am trying to run this code $files = array(\'readme.txt\', \'test.html\', \'image.gif\'); $z开发者_如何学运维ip = new ZipFile;

I am trying to run this code

$files = array('readme.txt', 'test.html', 'image.gif');
$z开发者_如何学运维ip = new ZipFile;
$zip->open('file.zip', ZipArchive::CREATE);
foreach ($files as $file) {
  $zip->addFile($file);
}
$zip->close();

header('Content-Type: application/zip');
header('Content-disposition: attachment; filename=filename.zip');
header('Content-Length: ' . filesize($zipfilename));
readfile($zipname);

And realized I had to install the PECL zip entension, which I believe I did corectly as once it was comopleted, it added this to my phpinfo();

Installing PECL Zip Extension

Even after installing this extension, I'm still getting this message.

Fatal error: Class 'ZipFile' not found in


Have a look at the manual:

$zip = new ZipArchive();

The class is called ZipArchive, not ZipFile.

0

精彩评论

暂无评论...
验证码 换一张
取 消