gongzhonghao.png
扫码关注我们
最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

php导出cvs xls xlsx的解决方案方法

来源:http://erdangjiade.com/topic/1859.html 你好,世界。 2017-09-25 22:42浏览(26)

/**
 * 导出日志
 */
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 = "标题,地址,作者,添加时间"."
";
   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'])."
";
   }
   echo $result;return;
}

以上就是php导出cvs xls xlsx的解决方法的详细内容,更多请关注二当家的素材网其它相关文章!

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2