PHP導出excel文件名中文IE亂碼解決


<?php        
	$ua = strtolower($_SERVER['HTTP_USER_AGENT']); 
	if(preg_match('/msie/', $ua) || preg_match('/edge/', $ua)) { 
		$filename = str_replace('+', '%20', urlencode($filename));
	}
	ob_end_clean();//清除緩沖區,避免亂碼
	// Redirect output to a client’s web browser (Excel5)
	header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
	header("Content-Type:application/force-download");
	header("Content-Type:application/vnd.ms-execl");
	header("Content-Type:application/download");
	header('Content-Disposition:attachment;filename="'.$filename.date('Y-m-d',time()).'.xls"');
?>

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM