凌的博客

您现在的位置是: 首页 > 学无止境 > PHP > 

PHP

php 生成下载html文件

2015-05-23 PHP 1044
/** * @desc 生成下载html文件 * @param string 文件名称 * @param string $content 写入内容 */ function download_html($filename,$content){ header(\"Expires: Mon, 26 Jul 1997 05:00:00 GMT\"); header
/**
 * @desc 生成下载html文件
 * @param string 文件名称
 * @param string $content 写入内容
*/
function download_html($filename,$content){
  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
  header("Cache-Control: no-cache, must-revalidate");
  header("Pragma: no-cache");   
  header("Content-Type: application/force-download");           
  header("Content-type: text/html");
  header("Content-Disposition: attachment; filename=".$filename.'.html'); 
  header("Content-Description: PHP5 Generated Data");	
  echo $content;
}


文章评论

0条评论