PHP下载文件出现乱码

解决办法:

//输入文件标签 
        header("Content-type: application/octet-stream");  
        header("Accept-Ranges: bytes");  
        header("Accept-Length: ".filesize($file_url));  
        header("Content-Disposition: attachment; filename=".$file_name);  
        ob_clean();
        flush();

加上header下面的两行代码即可。

猜你喜欢

转载自blog.csdn.net/weixin_41728561/article/details/80696317