【摘录】PHP异步调用实现方式

PHP异步执行的常用方式常见的有以下几种,可以根据各自优缺点进行选择:

1.客户端页面采用AJAX技术请求服务器

2.popen()函数

3.curl扩展

4.fscokopen()函数

 

这里主要介绍curl扩展的方法,因为其它几种没仔细看。

$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $remote_server);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_exec($ch);
curl_close($ch);

参考链接

http://www.cnblogs.com/gaoxu387/archive/2011/10/26/2224740.html

http://pcwanli.blog.163.com/blog/static/45315611201291774214657/

posted on 2012-12-07 15:54  comeby  阅读(220)  评论(0编辑  收藏  举报