让浏览器输出一个xml的下载, ie6下面问题真多 两个函数
function is_ie (){
//Not Internet Explorer
return stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE;
}
function encode_filename($name){
return is_ie() ? urlencode($name) : $name;
}
特定的header
header('Content-Type: application/xml');
header("Content-Disposition: attachment;filename=". encode_filename("测试-" . $t->name . ".xml"));
header('Pragma: private');
header('Cache-control: private, must-revalidate');
echo $xw->outputMemory();
参考这个: http://markmail.org/message/i4okzvwuxmeggrkp
这个: http://www.jtricks.com/bits/content_disposition.html
- The filename should be in US-ASCII charset.
- The filename should not have any directory path information specified.
- The filename should not be enclosed in double quotes even though most browsers will support it.
- Content-Type header should be before Content-Disposition.
- Content-Type header should refer to an unknown MIME type (at least until the older browsers go away).