如何在PHP中实现显示EXECEL?

解决方案 »

  1.   

    在header里面添加输出,设定为excel
    或者有专门的类库
    php2excel之类的.
      

  2.   

    header("Content-type:application/vnd.ms-excel");
    header("Content-Disposition:filename=test.xls");
    echo "我\t爱\t你\n"
      

  3.   

     header("Content-type: application/vnd.ms-excel; charset=GB2312");
        header("Content-Disposition: attachment; filename=$file_name.xls");    /* 订单数量, 销售出商品数量, 销售金额 */
    echo "时间" . "\t";
        echo "订单数(单位:个)" ."\t";
        echo "营业额(单位:元)" . "\t\n";
        while( $array = mysql_fetch_array($result) )
        {
    echo $array['set_name'] . "\t";
            echo $array['order_num'] . "\t";
            echo $array['turnover'] . "\t";
            echo "\n";
        }
    exit;