标签:
$filename = "filename.txt"; header("Content-Type: application/octet-stream"); header(‘Content-Disposition: attachment; filename="‘ . $filename . ‘"‘);
$ua = $_SERVER["HTTP_USER_AGENT"]; $filename = "中文文件名.txt"; $encoded_filename = urlencode($filename); $encoded_filename = str_replace("+", "%20", $encoded_filename);
1 header("Content-Type: application/octet-stream"); 2 if (preg_match("/MSIE/", $_SERVER[‘HTTP_USER_AGENT‘]) ) { 3 header(‘Content-Disposition: attachment; filename="‘ . $encoded_filename . ‘"‘); 4 } elseif (preg_match("/Firefox/", $_SERVER[‘HTTP_USER_AGENT‘])) { 5 header(‘Content-Disposition: attachment; filename*="utf8‘ . $filename . ‘"‘); 6 } else { 7 header(‘Content-Disposition: attachment; filename="‘ . $filename . ‘"‘); 8 }
标签:
原文地址:http://www.cnblogs.com/bloveice0915/p/5432157.html