Closed hardywen closed 8 years ago
确实有这个问题
不过你可以不用return response()->json([]); 直接return []; Lumen会自动加上json头的
好的 这个我可以试试。 不过还发现另外一个问题: 用php 的 header("Location:xxx"); exit; 这种跳转方式,貌似不起做用。(这是有用到另一个微信登录的组件,它用到了这种方式跳转)
已经修复,将Illuminate\Http\Response
换成Symfony\Component\HttpFoundation\Response
就可以了
swoole
的http server处理php的header方法似乎有点问题
header("Location:xxx");
可以用return redirect('xxx');
代替
另外swoole的http服务是常驻进程,如果用exit方法会杀掉当前的server进程,所以swoole不支持这种方式的跳转。
谢谢反馈!
好的。用上swoole之后貌似还得小心用第三方组件了 :) 谢谢 ps:性能上,我的项目是提升了不少,qps大概是原来的2倍左右
https://github.com/z-song/lumen-swoole/blob/master/src/Server.php#L312 https://github.com/z-song/lumen-swoole/blob/master/src/Server.php#L359
这两行的response参数有限制了 必须是 Illuminate\Http\Response 但项目中用到 response()->json([]); 这样的返回值的话,是 Illuminate\Http\JsonResponse 的实例,导致报错了。
所以可不可以去掉这个限制? 或者做到满足这两种返回实例呢