【php+excel】php 操作mysql 数据库生成Excel 并保存到服务器指定目录


$user_path=$_SERVER['DOCUMENT_ROOT']."/uploads/up/";

        $filename = date('YmdHis',time()).'商品信息.xlsx';

        $filename = iconv("utf-8","gb2312",$filename);

        $objWriter = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'Excel2007');
        
//        ob_end_clean();
//        header("Pragma: public");
//        header("Expires: 0");
//        header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
//        header("Content-Type:application/force-download");
//        Header("Content-type: applicationnd.ms-excel ;charset=utf-8");
//        header("Content-Type:application/octet-stream");
//        header("Content-Type:application/download");
//        header("Content-Disposition:attachment;filename=".$filename);
//        header("Content-Transfer-Encoding:binary");
//        $objWriter->save("php://output");
          $objWriter->save($user_path.$filename);
    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM