我正在使用 getResponse api 来获取订阅者的最新信息。
这是之后打印的内容var_dump($result);
object(stdClass)#2 (1) {
["updated"]=>
int(1)
}
我如何提取/解码/编码结果以请求密钥:“更新”并获取其值:1?
Thanks
// json object.
$contents = '{"firstName":"John", "lastName":"Doe"}';
// Option 1: through the use of an array.
$jsonArray = json_decode($contents,true);
$key = "firstName";
$firstName = $jsonArray[$key];
// Option 2: through the use of an object.
$jsonObj = json_decode($contents);
$firstName = $jsonObj->$key;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)