0
我有下載的PC設備進行下面的代碼下載文件
$file_url_source = "C:/test.xlsx";
$file_url = "C:/test.xlsx";
header('Content-Type: text/json; charset=UTF-8;');
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($file_url_source)."") . '"';
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file_url));
ob_clean();
flush();
readfile($file_url);
但它不工作的移動設備(我只是測試它在Android手機,並下載download.php
文件)。我如何讓移動設備下載文件?
你爲什麼內容類型和處置多次設置? – ElefantPhace
@ElefantPhace我只是編輯 – freestyle