如何在窗口上运行Php Zip文件创建程序 [英] How Can I Run Php Zip File Creation Program On Window

查看:88
本文介绍了如何在窗口上运行Php Zip文件创建程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我已经在php中创建了一个zip文件创建程序,我使用ubantu作为我的操作系统。它工作得很好但是当我在窗口上运行时它给我错误而不创建任何zip文件。



这是代码:





$ Zip = new ZipArchive();

$ filelocation ='update';

$ Ziplocation ='ZipVila / ZipEx.zip';

$ Zipfolder ='ZipVila';



$ Zip-> open($ Ziplocation ,ZipArchive :: CREATE | ZipArchive :: OVERWRITE);

$ files = scandir($ filelocation);



print_r($ files) ;



未设置($ file [0],$ file [1]); //窗口在此行中显示错误,它显示未定义目标文件。



foreach($ files as $ file){

$ Zip-> addfile($ filelocation。/ {$ file},$ file);

echoFile Added;

}



$ Zip-> close();

echoZip Closed;

?>



这项工作对我的ubantu完全没问题,但在我的窗户上运行不好

请有人告诉我这里有什么错误吗?

谢谢

Hello, i have created a zip file creation program in php and i used ubantu as my os. it works fine on that but when i run that on window it gives me error and not creating any zip file .

Here is the code:


$Zip = new ZipArchive();
$filelocation = 'update';
$Ziplocation = 'ZipVila/ZipEx.zip';
$Zipfolder = 'ZipVila';

$Zip->open($Ziplocation, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$files = scandir($filelocation);

print_r($files);

unset($file[0], $file[1]); // window gives error in this line, it shows object file is not defined.

foreach ($files as $file) {
$Zip->addfile($filelocation."/{$file}", $file);
echo "File Added";
}

$Zip->close();
echo "Zip Closed";
?>

This work totally fine on my ubantu but not running well on my Window
please can anyone tell me what is the error here ?
thanks

推荐答案

Zip = new ZipArchive();
Zip = new ZipArchive();


filelocation ='update';
filelocation = 'update';


Ziplocation ='ZipVila / ZipEx.zip';
Ziplocation = 'ZipVila/ZipEx.zip';


这篇关于如何在窗口上运行Php Zip文件创建程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆