PHP是怎么处理异常的?像下面这样的代码,如何得知是执行成功了还是失败了?
public function get_user($ch, $apikey) {
\Think\Log::record('into get_user...');
curl_setopt($ch, CURLOPT_URL, 'https://sms.xxx.com/v2/user/get.json');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('apikey' => $apikey)));
$response = curl_exec($ch);
\Think\Log::record('$response : '.$response);
if (false === $response) {
die(curl_error);
}
return $response;
}
自己运行调试吧,不解释了。