php导出csv,xls

    技术2025-11-07  6

      最恨网上那些自以为是的家伙,说"这很简单","换成这就行了"然后下面贴上 一堆 函数跟 类,麻痹的 以为别人都不会写函数和类,直接说原理 有那么麻烦吗,哎。。。。

     

     <? header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=test.csv"); echo "test1,"; echo "test2,"; echo "test1,"; echo "test2/t/n"; ?>

    <? header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=test.xls"); echo "test1/t"; echo "test2/t/n"; echo "test1/t"; echo "test2/t/n"; ?>

     

    另外,关于乱码,csv网上有个经典解决方法,就是在echo "test1,"之前先 echo "/xEF/xBB/xBF";牛人,称赞,膜拜

    xls没深入研究,感觉也没必要,两个不守规矩的家伙(微软跟gb2312)所以懒得跟这些东西 瞎折腾,直接去网上搜了个php-excel.class.php,还是老外写的好,即简洁,又实用,,,,,,

    最新回复(0)