标签:中文乱码
$ua = $_SERVER["HTTP_USER_AGENT"]; $filename = "中文 文件名.txt"; $encoded_filename = urlencode($filename); $encoded_filename = str_replace("+", "%20", $encoded_filename); header(‘Content-Type: application/octet-stream‘); if (preg_match("/MSIE/", $ua)) { header(‘Content-Disposition: attachment; filename="‘ . $encoded_filename . ‘"‘); } else if (preg_match("/Firefox/", $ua)) { header(‘Content-Disposition: attachment; filename*="utf8\‘\‘‘ . $filename . ‘"‘); } else { header(‘Content-Disposition: attachment; filename="‘ . $filename . ‘"‘); } print ‘ABC‘;
本文出自 “风吹雪落” 博客,请务必保留此出处http://cbsizhang.blog.51cto.com/7436956/1587930
标签:中文乱码
原文地址:http://cbsizhang.blog.51cto.com/7436956/1587930