【发布时间】:2010-01-04 20:11:00
【问题描述】:
我正在使用 PHP curl 方法来获取字符串类型的响应。要创建我使用的请求:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, $data);
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if($response === false)
throw new Exception(__CLASS__."::".__FUNCTION__."_".$err);
return $response;
为什么我总是收到 bool(true) 响应而不是我从对方回显的字符串?
谢谢
【问题讨论】:
-
您所说的“真实”响应是什么意思? $response 是字符串“true”,还是布尔值 true?