use*_*853 13 php arrays stdclass
所以我将这个数组保存在变量标题中$arr
.我想抓住或回应[slug]的价值
Array ( [0] => stdClass Object ( [term_id] => 11
[name] => Community Service
[slug] => community-service
[term_group] => 0
[term_taxonomy_id] => 11
[taxonomy] => category
Run Code Online (Sandbox Code Playgroud)
所以我想要这样的东西
echo $ arr [slug]
然后显示"社区服务".我确信这很容易,但我无法弄清楚如何从数组stdClass中获取值并在页面上回显它.谢谢.
对不起,你可以做一些更优雅的事.
foreach ($array as $obj)
{
// Here you can access to every object value in the way that you want
echo $obj->term_id;
}
Run Code Online (Sandbox Code Playgroud)