由于Drupal7本身的api不完善,不能使用Drupal API提供的函数来创建zip包,只能使用php的方法来创建。 $zip = new ZipArchive; // Store current directory. $site_path = getcwd(); if ($zip->open($zip_path, ZipArchive::CREATE) === TRUE) { // Change directory to "tagert" directory. chdir($file_path); foreach (glob('*') as $file) { $zip->addFile($file); } $zip->close(); } // Restore directory to site root directory. chdir($site_path);
$header = array( 'Content-Type' => 'application/zip', 'Content-Length' => filesize($zip_path), );
file_transfer($zip_uri, $header);
查看更多关于Drupal7 创建 zip 包并下载 实现代码的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did8385