HTML:
<a href="{:url('orderlogdoexcel',input())}" class="piliang-btn-style">批量导出</a>
PHP:
public function orderlogdoexcel()
{
$fileName = 'orderlog.xlsx';//导出文件名
$param = input();
header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Content-Disposition: attachment; filename=\"{$filename}\"");
// TODO
// 这里写一些业务逻辑
//
WriterFactory::create(Type::XLSX)
->openToBrowser($fileName)
->addRow([
'order_no' => '订单编号',
'username' => '会员编号',
'number' => '数量',
'w_time' => '创建时间',
])
->addRows($data)
->close();
}