时间:2021-07-01 10:21:17 帮助过:27人阅读
/** * 导出日志 */ public function excel() { setlocale(LC_ALL, 'en_US.UTF-8'); $filename = date('YmdHis') . ".csv"; header("Content-type:text/csv"); header("Content-Disposition:attachment;filename=" . $filename); header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); header('Expires:0'); header('Pragma:public'); $db = Db::name($this->table)->order('id desc'); $excelinfo = parent::_excel($db); $result = "标题,地址,作者,添加时间"."\n"; foreach ($excelinfo as $v_excelinfo){ $result.=replaces_string($v_excelinfo['article_title']).','. replaces_string($v_excelinfo['url']).','. replaces_string($v_excelinfo['article_author']).','. replaces_string($v_excelinfo['article_publish_time'])."\n"; } echo $result;return; }
以上就是php导出cvs xls xlsx的解决方法的详细内容,更多请关注Gxl网其它相关文章!