PHP 代码中的所有内容都是正确的(我自己检查过),并且 curl 没有错误,但结果始终是一个空变量(无真/假)。
public function prepareUser() {
$url = $this->TwitchAPI->endUrl("USERT");
$temp = curl_init();
curl_setopt($temp, CURLOPT_URL, $url);
curl_setopt($temp, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($temp, CURLOPT_HEADER, array("Authorization" => "OAuth " . $this->access_token));
curl_setopt($temp, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($temp, CURLOPT_SSL_VERIFYPEER, false);
$ret = curl_exec($temp);
if (curl_errno($temp)) {
die("Error - " . curl_error($temp));
}
curl_close($temp);
$this->user = json_decode($ret);
}