thinkphp做了一个下载功能,在本地能下载,传到linux服务器页面就出现乱码?
//发送HttpHeader信息开始下载header("Pragma:public");header("Expires:0");header("Cache-control...
//发送Http Header信息 开始下载
header("Pragma: public");
header("Expires: 0");
header("Cache-control: max-age=".$expire);
//header('Cache-Control: no-store, no-cache, must-revalidate');
header("Expires: " . gmdate("D, d M Y H:i:s",time()+$expire) . "GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s",time()) . "GMT");
header("Content-Disposition: attachment; filename=".$showname);
header("Content-Length: ".$length);
header("Cache-control: private");
header("Pragma: no-cache" ); //不缓存页面
header("Cache-Component: must-revalidate, post-check=0, pre-check=0" );
header("Content-Disposition: attachment; filename=".iconv('UTF-8','GB2312//TRANSLIT',$showname));
// header("Content-type: application/octet-stream;charset=utf-8");
header("Content-type:text/html;charset=utf-8");
header('Content-Encoding: UTF-8');
header("Content-Transfer-Encoding: binary" );
if($content == '' ) {
ob_clean();
readfile($filename);
}else {
echo($content);
}
exit(); 展开
header("Pragma: public");
header("Expires: 0");
header("Cache-control: max-age=".$expire);
//header('Cache-Control: no-store, no-cache, must-revalidate');
header("Expires: " . gmdate("D, d M Y H:i:s",time()+$expire) . "GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s",time()) . "GMT");
header("Content-Disposition: attachment; filename=".$showname);
header("Content-Length: ".$length);
header("Cache-control: private");
header("Pragma: no-cache" ); //不缓存页面
header("Cache-Component: must-revalidate, post-check=0, pre-check=0" );
header("Content-Disposition: attachment; filename=".iconv('UTF-8','GB2312//TRANSLIT',$showname));
// header("Content-type: application/octet-stream;charset=utf-8");
header("Content-type:text/html;charset=utf-8");
header('Content-Encoding: UTF-8');
header("Content-Transfer-Encoding: binary" );
if($content == '' ) {
ob_clean();
readfile($filename);
}else {
echo($content);
}
exit(); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询