我在php中創建了一個下載函數,其中文件中包含特殊字符。 但在下載文件時,文件名稱會從某些特殊字符中斷開。 主要在獲取文件名的空間時。 我的下載功能是這樣的。不想在文件名中創建具有特殊字符的下載功能
function download(){
$filename = "google _(){}[][email protected]#$%^&*()_+`1=-.flv";
$filepath = "uploads/" . $filename;
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
//setting content type of page
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=" . $filename);
header("Content-Description: File Transfer");
//Read File it will start downloading
readfile($filepath);
}
請大家幫忙。
謝謝。 我昨天自己做了。 這樣。 'header(「Content-Disposition:attachment; filename = \」「。$ filename。」\「」);' 感謝您的回覆。 – 2012-03-10 06:53:12