用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > php教程

php header函数下载中文文件名乱码(ie/chrome)

时间:2015-01-23  来源:西部数据  作者:西部数据

header函数在php中用处很多,下面我来介绍利用php中的header函数下载文件是中文在不同浏览器筹码的解决办法.

在下载文件中加入下段代码即可解决,代码如下:

  1. $name = rawurlencode($filename); 
  2. header("Content-type: text/plain; charset=utf-8"); 
  3. header("Content-Type: application/force-download"); 
  4. header("Content-Type: application/octet-stream"); 
  5. header("Content-Type: application/download"); 
  6. header('Content-Disposition:inline;filename="'.$name.txt.'"'); 
  7. header("Content-Transfer-Encoding: binary"); 
  8. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
  9. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
  10. header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
  11. header("Pragma: no-cache"); 
来顶一下
返回首页
返回首页
推荐资讯
WiFi太不安全:7岁女孩11分钟内入侵公共网络 WiFi太不安全:7岁女孩11分钟内入侵近期刚刚发布研究说WiFi网络能获得人们手机里多少私人信息,
不服跑个分?人工智能也出现“刷分”乱象 不服跑个分?人工智能也出现“刷分2014年,人工智能领域突然爆发,成为了科研和科技创业的热门
相关文章
栏目更新
栏目热门