/** * 导出日志 */ 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的解决方法的详细内容,更多请关注php中文网其它相关文章!
已抢26625个
抢已抢14075个
抢已抢7078个
抢已抢8589个
抢已抢17501个
抢已抢7029个
抢