检查谷歌reCAPTCHA的响应

时间:2016-03-01 18:20:40

标签: php recaptcha

我正在发送google recaptcha并获取响应对象

stdClass Object
(
[success] => 1
[challenge_ts] => 2016-03-01T18:15:36Z
[hostname] => localhost
)

如何获得成功的价值,看它是否为1

PS:值名称为$ response.I尝试if($ response [“success”] === true)不起作用。

1 个答案:

答案 0 :(得分:1)

根据您的评论,很明显响应是一个对象,而不是一个数组。

因此你必须使用

$response->success;

而不是

$response["success"];
相关问题