当用户触发事件,如果不能保证在5s内响应,可以先返回success,然后异步调用返回的信息。代码如下:

1   // 立即返回(异步执行)
2  ignore_user_abort(true);//start=========
3  ob_start();
4  echo 'success'; // send the response
5  header('Connection: close');
6  header('Content-Length: ' . ob_get_length());
7  ob_end_flush();
8  ob_flush();
9  flush();//end===============          
//以下为调用客服消息接口,回复用户消息的代码

 

相关文章:

  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2021-04-29
  • 2021-11-19
  • 2021-05-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案