凌的博客

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

PHP

php 生成txt文件

2022-03-24 PHP 2610
	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条评论