直接贴代码
$ch = curl_init('http://www.baidu.com');
$a = curl_setopt($ch, CURLOPT_COOKIE, 'name=houming');
$b = curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$error = curl_error($ch);
var_dump($a,$b,$error);
返回结果:
bool(false)
bool(true)
string(0) ""
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
看下什么错误,我这边执行你的代码是TRUE
如果上面的不行,可以用下面的方法