php下载的文件中文乱码 我时用rtf命令写进去然后下载,有没有哪个命令可以更改编码的。我看到word上显示的iso-8859-1的格式 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用rtf写中文是必须用\'吗?但是我要把utf-8格式的中文写进去啊,用内码能行吗?? function download($filename){ $timestamp=time(); ob_end_clean(); header('Last-Modified: '.gmdate('D, d M Y H:i:s',$timestamp+86400).' GMT'); header('Cache-control: max-age=86400'); header('Expires: '.gmdate('D, d M Y H:i:s',$timestamp+86400).' GMT'); header('Content-Encoding: none'); $basename = basename($filename); $fileext = substr(strrchr($basename,'.'),1); $filesize = filesize($filename);; if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')!==false && $fileext=='torrent' ){ $attachment='inline'; } else{ $attachment='attachment'; } header('Content-Disposition: '.$attachment.'; filename='.$basename); header('Content-type: '.$fileext); $filesize && header('Content-Length: '.$filesize); readfile($filename); exit;} 你尝试一下变换编码。比如 utf-8 -> gb2312 或者 gb2312 -> utf-8<?phpecho iconv("ISO-8859-1", "UTF-8", "This is a test.");?>http://cn.php.net/manual/en/function.iconv.php 请教PHP服务器设置问题 cookie的expire时间戳? 很简单得问题?? 编写PHP时,大家都用什么IDE呀!? 看看这个问题!IIS搭配PHP5的问题! 如何解决返回时出现网页过期的问题? 在WIN98中如何在PHP中安装PEAR IIS+PHP中如何得到WEB根目录? 我是用delphi的,现在想转入php,不知她前景如何,请各位兄弟告之! php提交处理 php技术提问 php 查询记录集的 while嵌套问题
但是我要把utf-8格式的中文写进去啊,用内码能行吗??
$timestamp=time();
ob_end_clean();
header('Last-Modified: '.gmdate('D, d M Y H:i:s',$timestamp+86400).' GMT');
header('Cache-control: max-age=86400');
header('Expires: '.gmdate('D, d M Y H:i:s',$timestamp+86400).' GMT');
header('Content-Encoding: none');
$basename = basename($filename);
$fileext = substr(strrchr($basename,'.'),1);
$filesize = filesize($filename);;
if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')!==false && $fileext=='torrent' ){
$attachment='inline';
} else{
$attachment='attachment';
}
header('Content-Disposition: '.$attachment.'; filename='.$basename);
header('Content-type: '.$fileext);
$filesize && header('Content-Length: '.$filesize);
readfile($filename);
exit;
}
<?php
echo iconv("ISO-8859-1", "UTF-8", "This is a test.");
?>
http://cn.php.net/manual/en/function.iconv.php