我正在为我的网站使用谷歌网站验证 recaptcha API。
$json = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response=".$response."&remoteip=".$ip);
当我打印echo $json;
它显示正确的响应时
{ "success": true, "challenge_ts": "2018-08-23T12:43:42Z", "hostname": "staging.my.com" }
但是当我尝试
$data = json_decode($json,true);
echo $data->success;
它什么也没显示
谁能告诉我我错过了什么?