开发者

Installing PECL Zip Extension

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜