jon*_*477 4 php laravel laravel-5
我正在使用Classic Paypal API,在处理请求数据之前遇到了响应问题。
public function store() {
// Send an empty HTTP 200 OK response to acknowledge receipt of the notification
response("", 200);
// Build the required acknowledgement message out of the notification just received
// Once it hits this point, nothing is sent to the client.
}
Run Code Online (Sandbox Code Playgroud)
我知道,为了使客户端能够接收HTTP 200响应,我需要在其前面添加return关键字。但是,如果我立即返回响应,那么将不会进行请求的处理。我研究过中间件之前和之后,但不幸的是它们不是异步的。Laravel 5中有什么方法可以完成发送然后处理?
我找到了解决此问题的方法:
try {
return response("", 200);
} finally {
// Controller logic here
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1343 次 |
| 最近记录: |