$response = Yii::$app->getResponse();
$response->format = $response::FORMAT_RAW;
$response->getHeaders()->set('Content-Type', 'application/vnd.ms-excel');
$response->getHeaders()->set('Content-Disposition', 'attachment;filename="EXCEL.xls');
$response->getHeaders()->set('Cache-Control', 'max-age=0');
$r=(new \yii\db\Query())
->select(['files'])
->from('tb')
->where(['id' => '11'])
->one();
return $r['files'];
YII2 返回文件
最新推荐文章于 2023-03-14 10:54:14 发布