//下载文件
header('Content-Type:application/octet-stream');
if(preg_match('/MSIE/',$_SERVER['HTTP_USER_AGENT'])){
header('Content-Disposition:attachment;filename="'.str_replace("+","20%",urlencode($newFileName)).'"');
}else if(preg_match('/Firefox/',$_SERVER['HTTP_USER_AGENT'])){
header('Content-Disposition:attachment;filename=*"utf8'.$newFileName.'"');
}else{
header('Content-Disposition:attachment;filename="'.$newFileName.'"');
}
PHP下载txt文件到浏览器
最新推荐文章于 2021-12-08 11:30:22 发布