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 Jenkins+k8s部署slave节点offline
  • ¥15 微信小游戏反编译后,出现找不到分包的情况
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题