header('Expires: 0');
header('Cache-control: private');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Description: File Transfer');
header('Content-Type: application/csv; charset=utf-8');
//header('Content-disposition: attachment; filename='.$filename.'.csv');
if(strpos($_SERVER['HTTP_USER_AGENT'],"MSIE"))
header( 'Content-Disposition: attachment; filename="'.urlencode($filename).'.csv' );//如果是ie存为的名字要urlencode
else
header( 'Content-Disposition: attachment; filename="'.$filename.'.csv' );//存为的名字