码迷,mamicode.com
首页 > 微信 > 详细

微信超时5s,调用客服接口异步回复消息(PHP)

时间:2016-12-12 14:06:45      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:客服   消息   微信   get   close   end   事件   length   不能   

当用户触发事件,如果不能保证在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===============          
//以下为调用客服消息接口,回复用户消息的代码

 

微信超时5s,调用客服接口异步回复消息(PHP)

标签:客服   消息   微信   get   close   end   事件   length   不能   

原文地址:http://www.cnblogs.com/ding-daisy/p/6163992.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!