本文介绍了跨浏览器PHP下载文件名中的中文随机码问题的解决方案,供大家参考:

复制代码代码如下:< PHP

UA _server美元美元{ =http_user_agent};

文件名为中文文件名;

encoded_filename美元= urlencode($文件名);

encoded_filename美元= str_replace(+

头('content-type:应用/字节流);

如果(preg_match( / / MSIE

头('content-disposition:附件文件名=。encoded_filename美元。);

} else if(preg_match( / / 火狐

头('content-disposition:依恋;文件名=UTF8 。$文件名;

{人}

头('content-disposition:附件文件名=。文件名;

}

print'abc;

>

希望本文能对大家的PHP程序设计有所帮助。