[英]ZipArchive extractTo() not working with URL
I am trying to extract a ZipArchive
to 'http://localhost/MODULES/ZIP_RAR_MANAGER/'
. 我试图将
ZipArchive
提取到'http://localhost/MODULES/ZIP_RAR_MANAGER/'
。
No errors are shown, and I get the message Zip File Opened
. 没有显示错误,我得到消息
Zip File Opened
。
Why are the files not being correctly extracted from the zip archive? 为什么无法从zip存档正确提取文件?
$zip = new ZipArchive;
if ($zip->open('../test.zip'))
{
echo 'ZIP FILE OPENED...<br/>';
if ($zip->extractTo('http://localhost/MODULES/ZIP_RAR_MANAGER/'))
{
echo 'ZIP FILE EXTRACTED';
}
$zip->close();
}
else
{
echo 'failed';
}
You are trying to extract it to non-existent folder http://localhost/MODULES/ZIP_RAR_MANAGER/
. 您试图将其解压缩到不存在的文件夹
http://localhost/MODULES/ZIP_RAR_MANAGER/
。 You cannot use url as a folder/file path. 您不能将url用作文件夹/文件路径。
You should use: 您应该使用:
if ($zip->extractTo($_SERVER['DOCUMENT_ROOT'] . '/MODULES/ZIP_RAR_MANAGER/') {
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.