duanpengya7074
2014-02-03 01:53
浏览 55
已采纳

PHP / cURL脚本请求另一个PHP脚本并在响应之前退出

I'd like a browser-initiated PHP script A on Server A to send a cURL request for a PHP resource B located on Server B, but not wait for a reply (it's only supposed to start script B and die). Will script B abort if it notices that the requesting script A has exited? If so, can this be overcome simply by including

ignore_user_abort(true);

in script B, just like for browser requests? What needs to be done to ensure script B goes to completion? Assume safe mode is enabled: no forking, daemons, etc, that's why I'm taking two separate servers.

图片转代码服务由CSDN问答提供 功能建议

我想在服务器A上使用浏览器启动的PHP脚本A来发送PHP资源的cURL请求B 位于服务器B上,但等待回复(它只能启动脚本B并死掉)。 如果脚本B注意到请求脚本A已退出,是否会中止? 如果是这样,可以通过在脚本B中包含

  ignore_user_abort(true); 
   
 
 

来解决这个问题, 就像浏览器请求一样? 需要做些什么才能确保脚本B完成? 假设安全模式已启用:没有分叉,守护进程等,这就是为什么我要使用两个独立的服务器。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duan010167787 2014-02-03 02:15
    已采纳

    Yes, if ignore_user_abort() is set to true on script B, then script B will continue to run, regardless of what A did. However, it is still at the mercy of the *max_execution_time* setting

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题