curl post报错问题
程序员文章站
2022-04-22 15:43:11
...
curl_setopt() expects parameter 2 to be long 是什么错误??
//初始化curl $ch = curl_init(); //设置超时 curl_setopt($ch, CURLOP_TIMEOUT, $this->curl_timeout); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //运行curl,结果以jason形式返回 $res = curl_exec($ch); curl_close($ch);
回复讨论(解决方案)
哪行报错??
curl_setopt($ch, CURLOP_TIMEOUT, $this->curl_timeout);
改成
curl_setopt($ch, CURLO P_TIMEOUT, $this->curl_timeout);
看错了,改成这样
curl_setopt($ch, CURLOP T_TIMEOUT, $this->curl_timeout);