if (!function_exists('output_for_download')) {
/**
* 下載文件到瀏覽器
*
* @param string $filename 文件路徑
* @param array $title 輸出的文件名
* @return void
*/
function output_for_download($filename, $title)
{
$file = fopen($filename, "rb");
Header( "Content-type: application/octet-stream ");
Header( "Accept-Ranges: bytes ");
Header( "Content-Disposition: attachment; filename= $title");
while (!feof($file)) {
echo fread($file, 8192);
ob_flush();
flush();
}
fclose($file);
}
}
文件下載
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.