-2

我如何创建一个 zip 目录并在其中创建一个文件。我试过但不知道如何压缩,但我能够创建一个目录并在其中创建一个新文件。

代码:

$directoryPath = "../word_plugin/".mobilesplash_. time(). _ .$c_id. _plugin;
mkdir($directoryPath);

$myFile = "$directoryPath/testFile.php";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Yoo";
fwrite($fh, $stringData);
$stringData = "Hello";
fwrite($fh, $stringData);  
fclose($fh);

提前感谢。

4

1 回答 1

0

使用ZipArchive 类!或RarArchive 类

所有可用的库

于 2013-07-26T09:03:42.173 回答