【发布时间】:2018-01-15 10:24:12
【问题描述】:
我现在正在尝试修复我的 php 函数。由于某种原因,它不能再读取 .zip 文件了。它发生在我更改我的 linux 服务器之后。在我拥有 php 5.6 之前,我现在拥有 php PHP 版本 7.0.22-0ubuntu0.16.04.1。是否需要一些特殊的 php 库?
这是我的代码,但我不认为有什么问题,因为它以前工作过:
/*
Get donwloaded version
*/
$downloadVersion = "Unknown";
$fileData = function() {
$file = fopen('zip://interface.zip#php/functions/functions.php', 'r');
if (!$file)
{
die('Can not read zip file! Please be sure, that we have in this folder the interface.zip file!');
};
while (($line = fgets($file)) !== false)
{
yield $line;
};
};
foreach ($fileData() as $line) {
if(strpos($line, "define(\"INTERFACE_VERSION\"") !== false)
{
$lineparts = explode("\"", $line);
$downloadVersion = $lineparts[3];
};
};
顺便说一句,interface.zip 文件存在我还用 php file_exists 函数检查了它。路径和文件 functions.php 也退出。有人有想法吗?如果我尝试打开页面,它会显示:
无法读取 zip 文件!请确定,我们在此文件夹中有 interface.zip 文件!
【问题讨论】: