一.生成Excel
找了个插件:PHP_XLSXWriter
github地址:https://github.com/mk-j/PHP_XLSXWriter
二.参考代码
我是按照我自己项目的写的代码,需要自己修改
发送邮件需要的下载的文件在上一篇博客有参考地址
//调用发邮件方法
public function sendEmail(){
require "static/lib/phpXlsxWriter/xlsxwriter.php";//调用生成execl文件的类文件
//前端传过来的收件人邮箱
$request=Request::instance();
$data=$request->param();
$toemail=$data["toemail"];//收件人邮箱
//$toemail="1146383603@qq.com";
$list=json_decode($data["incdata"],true);//要写入execl文件的数据
$subject="服务项目收入流水";
$body="这是40天服务项目流水统计,请注意查收!!";
//生成execl文件
//表格头信息
$header = array(
'时间'=>'string',//text
'价格'=>'string',//text
'佣金'=>