phpマニュアルでは、php.iniファイルでphp_zip.dllを有効にしており、phpインストールフォルダのextフォルダ内のphp_zip.dllもチェックしています。そこに現れます。郵便番号のコードを使用している間しかし、それは以下のようなエラーを示していますphp_zipのインストール方法
Fatal error: Class 'ZipArchive' not found in C:\inetpub\wwwroot\projectname\bulkdownload.php on line 9
後は、バルクdownload.phpのコード
<?php
function zipFilesAndDownload($file_names,$archive_file_name,$file_path)
{
$zip = new ZipArchive();
//create the file and throw the error if unsuccessful
if ($zip->open($archive_file_name, ZIPARCHIVE::CREATE)!==TRUE) {
exit("cannot open <$archive_file_name>\n");
}
//add each files of $file_name array to archive
foreach($file_names as $files)
{
$zip->addFile($file_path.$files,$files);
}
$zip->close();
//then send the headers to foce download the zip file
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=$archive_file_name");
header("Pragma: no-cache");
header("Expires: 0");
readfile("$archive_file_name");
exit;
}
$file_array = $_GET['voice'];
$file_names = explode(';', $file_array);
$archive_file_name = "voicefile.zip";
$file_path = "d:/temp_file/voice/";
zipFilesAndDownload($file_names,$archive_file_name,$file_path);
?>
あなたのPHPのバージョンは? Zipクラスはしばらくの間組み込まれています。 –
PHP 5.2.0とinetpubをWebサーバーとWindows 2008としてサーバーとしてインストールしました。 php_zip.dllが既にインストールされているか、組み込みのphp 5.2.0です。それでもエラーが表示されます –