php下载word或doc出现乱码问题
作者:佚名 时间:2015-10-06
1.首先检查编码是否一致
php下载word或doc时,出现乱码问题,我的php和word都是统一utf-8编码,所以不存在编码问题.
2.检查php下载文件前是否有缓存输出,主要看下面代码红色处,在输出下载文件前,先清除下缓存.
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$dname.'"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
ob_clean();
flush();
readfile($fpath . $fname);
如没特殊注明,文章均为上海联楷网络原创,转载请注明来自:http://www.linksj.com/contact/20151229/n7270.html