curl_multi_exec 本质上是多个套接字同时在发起请求,传输数据 epoll 多个套接字 (低层是使用libcurl网络库 + epoll 实现)
而单个curl_exec 是直接建立socket 上面封装协议 同步数据传输
curl_multi_select 之前木有调用curl_multi_exec 则始终返回-1 (因为木有执行curl_multi_exec, 则木有connect 内部使用了延迟连接特性)
curl_multi_exec 返回的是整个curl栈状态,及时返回curl_ok 个别curl传输依然是有问题de
Description: ------------ curl_multi_select() seems broken in PHP 5.3.18 on CentOS 6.3. The behavior of the test script below is different than it used to be, returning immediately without select with a -1 (failure) return value. Test script: --------------- $mh = curl_multi_init(); print curl_multi_select($mh, 1.0); curl_multi_close($mh); Expected result: ---------------- curl_multi_select() should take 1.0 seconds to complete and returns 0 Actual result: -------------- curl_multi_select() returns immediately with return value of -1
参考文献
http://blog.csdn.net/linkaisheng101990/article/details/49557483
http://php.net/manual/en/function.curl-multi-exec.php
http://blog.marchtea.com/archives/109
https://bugs.php.net/bug.php?id=63411