PHP CURL超时设置分两种,毫秒跟秒都是可以的。
curl普通秒级超时:
$ch = curl_init();curl_setopt($ch, CURLOPT_URL,$url)
;curl_setopt($ch, CURLOPT_RETURNTRANSFER,1)
;curl_setopt($ch, CURLOPT_TIMEOUT,60)
; //只需要设置一个秒的数量就可以curl_setopt($ch, CURLOPT_HTTPHEADER, $headers)
;curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT'])
;curl普通秒级超时使用:
curl_setopt($ch, CURLOPT_TIMEOUT,60)
;curl如果需要进行毫秒超时,需要增加:curl_easy_setopt(curl, CURLOPT_NOSIGNAL,1L)
;//或者curl_setopt ( $ch, CURLOPT_NOSIGNAL,true)
;//支持毫秒级别超时设置
顶一下

(0)
0%
踩一下

(0)
0%
- 相关评论
- 我要评论
-