window phpstudy8.1 curl总是返回false

馬飛
phpstudy2018测试正常,换成phpstudy8.1之后curl总是返回false,
curl_error返回空字符串,curl确认已经开启了,切换php的新旧版本7.3,5.6也不管用,
这可能是哪里原因呢?

问题比较着急?请联系QQ:760483
  • 馬飛
  • 馬飛    2021-06-10 17:55:582楼

    这是php代码

    $url = 'https://www.baidu.com'

    $ch = curl_init($url);

        curl_setopt($ch,CURLOPT_CUSTOMREQUEST,"POST");

        curl_setopt($ch,CURLOPT_POSTFIELDS,'');

        curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

        curl_setopt($ch,CURLOPT_HTTPHEADER,array(

            'Content-Type: text/plain'

        );

    curl_setopt($ch,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);

    // curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);

    dump(curl_error($ch));

        $res = curl_exec($ch);

        curl_close($ch);

        return $res;

    +添加回复

  • 回复