header("Content-type:application/vnd.ms-excel;charset=UTF-8");
$showtime=date("Y-m-d"); 
header("Content-Disposition:filename=checkin".$showtime.".xls");
echo "一"."\t"."二"."\t\n";
echo "一"."\t"."二"."\t\n";以上代码生成的excel出现乱码,如果大家有其他生成excel的方法,请不吝赐教.......各位大哥帮帮忙,小弟先谢了。

解决方案 »

  1.   

    楼主用的编码是utf8,
    在windows平台上,ms的excel在识别utf8编码时会以是否具有BOM头为准,如果没有的话,则显示乱码。不妨试试gb2312
      

  2.   

    fenyao的方法不行.....
    stars981:iconv转码 gbk是什么意思?怎么用?
      

  3.   

    function ConvertString($String){
        return iconv("UTF-8","GB2312",$String);
    }header("Content-type:application/vnd.ms-excel;charset=UTF-8");
    $showtime=date("Y-m-d");
    header("Content-Disposition:filename=checkin".$showtime.".xls");
    $output="";
    $output.="一"."\t"."二"."\t\n";
    $output.="一"."\t"."二"."\t\n";
    echo ConvertString($output);试试吧
      

  4.   

    多谢fenyao,你给的那个函数可以了,这里牛人就是多。