Created
August 8, 2013 03:50
-
-
Save homleen/6181302 to your computer and use it in GitHub Desktop.
PHP下载文件名乱码不完全解决方案。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ua = $_SERVER['HTTP_USER_AGENT']; | |
$name = "+ 孙_燕-姿 &✺☞& 繁體字&2013.doc"; | |
header('Content-Type: application/octet-stream'); | |
if (preg_match("/MSIE/", $ua)) { | |
header('Content-Disposition: attachment; filename="' . rawurlencode($name) . '"'); | |
} else if (preg_match("/Firefox/", $ua)) { | |
header('Content-Disposition: attachment; filename*="utf8\'\'' . rawurlencode($name) . '"'); | |
} else { | |
header('Content-Disposition: attachment; filename="' . $name . '"'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment