dtpw54085 2014-01-19 14:37
浏览 130
已采纳

为什么PHP的zip_read()返回false?

Why is PHP's zip_read() returning false? I've used this same script before, and it returned true.

$zip = zip_open("/tmp/ayb/test.zip");
if(is_resource($zip))
{
    $zip_read=zip_read($zip);
    echo($zip_read?'true':'false');
}
  • 写回答

3条回答 默认 最新

  • doukang2003 2014-01-19 14:39
    关注

    Scripts don't magically invert their behaviour for no reason. You changed something. You did something wrong. Don't blame the script. The ZIP got corrupted, or it's a different ZIP, or it's not there any more.

    The relevant manual page tells us:

    Returns a directory entry resource for later use with the zip_entry_... functions, or FALSE if there are no more entries to read, or an error code if an error occurred.

    Note that this means you should be testing $zip_read for more than basic truthiness. You should be examining it more closely for its precise value, and take your debugging from there.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验