gpt4 book ai didi

PHP json_decode - 处理命名空间

转载 作者:行者123 更新时间:2023-12-04 16:52:59 26 4
gpt4 key购买 nike

我正在尝试使用 PHP 和 json_decode 解析 JSON 文件,但是当返回的 JSON 是命名空间时,我很难做到这一点。例如:

$json_ouput = json_decode($json);

foreach ( $json_ouput->feed as $feed) {

/*
Here is the problem, $feed contains a namespaced key
$feed->ab:test->value // Does not work :(
*/
}

这里最好的解决方案是什么?

最佳答案

一直如此。

$feed->{'ab:test'}->value

关于PHP json_decode - 处理命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10810028/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com