<?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();