IPS 中文支持论坛 - IPS Chinese Support Community: 在IE中,中文附件文件名下载乱码的解决方法 - IPS 中文支持论坛 - IPS Chinese Support Community

跳转到内容

第一页
  • 您无法发起一个新主题
  • 您无法回复此主题

在IE中,中文附件文件名下载乱码的解决方法

#1 已离线   xinli 

  • 新手上路
  • 点子
  • 用户组: Member
  • 文章数: 24
  • 注册日期: 2008-09-28

发表于 2010-06-18 11:39:55

編輯文件:
admin\applications\core\sources\classes\attach\class_attach.php

查找:
PHP 代码:
header( "Content-Disposition: attachment; filename=\"{$attach['attach_file']}\"" );  

替换为:
PHP 代码:
/* attach name covertCharsets */ 
//    header( "Content-Disposition: attachment; filename=\"{$attach['attach_file']}\"" ); 
header( "Content-Disposition: attachment; filename=\"" . @iconv( "utf-8", $charset, $attach['attach_file'] ) . "\"" );  

注:使用了iconv函数

也可以使用urlencode,缺点是空格变成了+号
PHP 代码:
header( "Content-Disposition: attachment; filename=\"" . urlencode($attach['attach_file']) . "\"" );  

0

分享主题:


第一页
  • 您无法发起一个新主题
  • 您无法回复此主题