PHP export excel file name Chinese garbled solve the 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 (); // clear the buffer, to avoid distortion
	// 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"');
?>

  

Guess you like

Origin www.cnblogs.com/hnhycnlc888/p/11097986.html