dcat-admin
dcat-admin copied to clipboard
使用octane, 导出功能报错
- Laravel Version: 9.5.1
- PHP Version: 8.0.16
- Dcat Admin Version: 2.2.0-beta
在grid中启用export
function (Grid $grid) {
$grid->export()->xlsx();
$grid = $this->filter(
$grid,
['student', 'items', 'items.lesson', 'items.sku', 'ski'],
);
}
启动应用
➜ composer start-dev
> php artisan octane:start --watch --port=9821
INFO Server running…
Local: http://127.0.0.1:9821
Press Ctrl+C to stop the server
访问报错信息
同样遇到了这个问题。
这是因为返回响应后是由 Octane 再次转发到 Swoole/RoadRunner 服务器的,而因为 export()
是强制发送了响应(而不是返回一个响应对象由 Octane 捕获然后转发),所以 Octane 在读取响应内容的时候会直接读到文件内容。另外原生的 export()
方法里面也使用了 exit
,也导致了 swoole exit
的异常。
+1
有解决方案没?同样碰到这个导出的问题了
有解决方案,放在 learnku 了
吴博维 @.***
---原始邮件--- 发件人: @.> 发送时间: 2023年2月28日(周二) 晚上6:14 收件人: @.>; 抄送: @.@.>; 主题: Re: [jqhph/dcat-admin] 使用octane, 导出功能报错 (Issue #1686)
有解决方案没?同样碰到这个导出的问题了
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
更改之后还是无效,我用的是laravel-s,照道理来说是一样的,代码应该是没问题的,按照learnku一样的敲下来的
我的目的是 打包docker image, 之前用octane swoole 打包, 现在改为 nginx php的方式, 用基于 webdevops/php-nginx 打包, 最终image 大了很多,但功能正常了 0.0
尝试了好多遍,没有方法,这个exit太厉害了...用laravel-s这个包,再用dcat-admin做导出是没有好的办法的
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.