2011-08-02 21:42
浏览 155

安装PECL Zip扩展

I am trying to run this code

$files = array('readme.txt', 'test.html', 'image.gif');
$zip = new ZipFile;
$zip->open('', ZipArchive::CREATE);
foreach ($files as $file) {

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

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();

enter image description here

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

Fatal error: Class 'ZipFile' not found in

图片转代码服务由CSDN问答提供 功能建议


  $ files =  array('readme.txt','test.html','image.gif'); 
 $ zip = new ZipFile; 
 $ zip-> open('',ZipArchive :: CREATE);  
foreach($ files as $ file){
 $ zip-> addFile($ file); 
 $ zip-> close(); 
header('Content-Type:application / zip  '); 
header('Content-disposition:attachment; filename ='); 
header('Content-Length:'。filesize($ zipfilename)); 
readfile($ zipname); 


即使安装了此项 扩展,我仍然收到此消息。

致命错误: 中找不到类'ZipFile'

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • du5910 2011-08-02 21:47

    Have a look at the manual:

    $zip = new ZipArchive();

    The class is called ZipArchive, not ZipFile.

    点赞 评论

相关推荐 更多相似问题