php zip.so 编译出错,PHP Zip创建类ZipArchive未找到错误

我正在尝试根据我发现的内容创建一个zip脚本

here但我似乎遇到致命错误:新的ZipArchive()上没有找到类’ZipArchive’错误;功能.

研究这似乎通常是由于PHP的编译方式.我有一个共享主机帐户,所以我没有配置任何这些东西……我认为我不能对构建进行任何更改.出于兴趣,我看了一下我的phpinfo(),我找到了一些看似相关的东西:

PHP版本5.2.6

BZip2 Support Enabled

ZLib Support enabled

Stream Wrapper support compress.zlib://

Stream Filter support zlib.inflate, zlib.deflate

Compiled Version 1.1.4

Linked Version 1.1.4

我并不十分确定这是否意味着我有能力创建拉链.

有关更多信息(虽然我不认为它是重温的)这里是我的脚本到目前为止….这是未经考验的头脑你,因为我无法得到这个类未找到错误.

$file = tempnam("tmp", "zip");

$zip = new ZipArchive();

$zip->open($file, ZipArchive::OVERWRITE);

//the string "file1" is the name we're assigning the file in the archive

$zip->addFile('show1.jpg', 'file1.jpg');

$zip->addFile('show2.jpg', 'file2.jpg');

$zip->addFile('show3.jpg', 'file3.jpg');

$zip->addFile('show4.jpg', 'file4.jpg');

$zip->addFile('show5.jpg', 'file5.jpg');

$zip->addFile('show6.jpg', 'file6.jpg');

// echo $zip->file(); //this sends the compressed archive to the output buffer instead of writing it to a file.

$zip->close();

header('Content-Type: application/zip');

header('Content-Length: ' . filesize($file));

header('Content-Disposition: attachment; filename="' . $file.'"');

readfile($file);

unlink($file);

所以我的问题确实是:

>我在脚本中做了什么导致此错误?

>我的phpinfo()中的任何东西是否意味着我应该能够创建zip文件,如果我不应该在那里寻找什么,如果我有能力将让我知道.

>看起来这个ZLib是一些软库,但我不知道它是否做了我想做的事情,甚至不知道如何使用它….这有点像预感,但如果可以的话帮我创建zip文件谁能指点我如何使用它的正确方向?

提前致谢.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值