試圖寫的html文件,並打開文件對話框寫一個文件,並將其發送給用戶
爲用戶保存
,但沒有發生,沒有錯誤
任何想法?
謝謝
這是我的代碼
<?php
$css=$_POST['css'];
$html=$_POST['html'];
$handle = fopen("file.txt", "w");
fwrite($handle, $html);
fclose($handle);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($handle));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($handle));
ob_clean();
flush();
readfile($handle);
exit;
?>