<?php
//獲取1.html文檔的內容(包括html代碼)
$result = file_get_contents('./1.html');
echo "$result";
// /////////////////////保存///////////////////////////
//打開緩沖區
ob_start();
//指示響應可以被任何緩存區緩存
header("Cache-Control: public");
//設置一個下載類型
Header("Content-type: application/octet-stream");
//可以請求網頁實體的一個或者多個子范圍字段
Header("Accept-Ranges: bytes");
//判斷瀏覽器類型
if (strpos($_SERVER["HTTP_USER_AGENT"],'MSIE')) {
header('Content-Disposition: attachment; filename=test.doc');
}else if (strpos($_SERVER["HTTP_USER_AGENT"],'Firefox')) {
Header('Content-Disposition: attachment; filename=test.doc');
} else {
header('Content-Disposition: attachment; filename=test.doc');
}
//不使用緩存
header("Pragma:no-cache");
//過期時間
header("Expires:0");
//輸出全部內容到瀏覽器
ob_end_flush();