我使用此代码在Windows中创建zip文件
text
现在我希望使用此代码
在Ubuntu中提取此文件$plugin_address="D:/processmaker-3.2.1-x/apps/processmaker/htdocs/cakephp/plugins";
$rootPath = $plugin_address."/".$R;
$zipFileName = $rootPath.'.zip';
$zip = new ZipArchive();
$zip->open($zipFileName, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($rootPath),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file)
{
if (!$file->isDir())
{
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($rootPath) + 1);
$filePath=str_replace("\\","/",$filePath);
$zip->addFile($filePath, $relativePath);
}
}
$zip->close();
此代码工作并解压缩zip文件,但不创建目录和子目录。 此代码在文件名中设置目录名!
答案 0 :(得分:2)
I use this function for zip on windows that worked extract on linux
socket.whatever((data , client) => {
let temporaryValue = data.feed;
//Problem is that this keeps getting
//updated as it's connected
}