继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

php导出电子表格

四季花海
关注TA
已关注
手记 150
粉丝 40
获赞 160
//输出电子表格
    function export($file_name,$title = array(), $data) {
        $excel_str = str_replace("\n", "\t", implode("," , $title)) . "\n";
        $excel_str .= $data;
        $file_name = mb_convert_encoding ( $file_name, "GB2312", "UTF-8" );
        header ( "Content-Type: application/vnd.ms-execl" );
        header ( "Content-Disposition: attachment; filename=" . $file_name . ".csv" );
        header ( "Pragma: no-cache" );
        header ( "Expires: 0" );
        $str = mb_convert_encoding ( $excel_str, "GBK", "UTF-8" );
        echo $str;
        die();
    }


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP