凌的博客

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

PHP

php 生成txt文件

2020-02-06PHP0
	header('Content-Type: application/octet-stream');
	header('Content-type:text/plain');
	if(preg_match("/MSIE/",$_SERVER['HTTP_USER_AGENT']) ){
		header('Content-Disposition: attachment; filename="'.urlencode($txt_file).'"');
	}else if(preg_match("/Firefox/",$_SERVER['HTTP_USER_AGENT'])){
		header('Content-Disposition: attachment; filename*="utf8'.$txt_file.'"');
	}else{
		header('Content-Disposition: attachment; filename="'.$txt_file.'"');
	}
	header('Expires:0'); 
	header('Cache-Control:must-revalidate, post-check=0, pre-check=0'); 
	header('Pragma: public'); 
	echo '这是 txt 里面的内容';
	exit;


如果本文对您有所帮助,请支持下本站哦!!!^_^

文章评论

0条评论