PHP数组对象stdClass的 - 回波值
问题描述:
所以我有这个数组保存在一个变量的标题 $改编
。我想抓住或回声的价值[塞]
so I have this array saved in a variable title $arr
. I want to grab or echo the value of [slug]
Array ( [0] => stdClass Object ( [term_id] => 11
[name] => Community Service
[slug] => community-service
[term_group] => 0
[term_taxonomy_id] => 11
[taxonomy] => category
所以,我想是这样的。
So i want something like this
回声$改编[塞]
然后将显示社区服务。我相信这是一件pretty容易,但我无法弄清楚如何抓住了数组stdClass的值,并将它显示在页面上。谢谢你。
which would then display "community-service". I am sure this is something pretty easy but i can't figure out how to grab the value out of an array stdClass and echo it on the page. Thank you.
答
阵列 $改编
包含1项是一个对象。你必须使用 - 方式>
语法来访问它的属性。
The array $arr
contains 1 item which is an object. You have to use the ->
syntax to access it's attributes.
回声$改编[0] - >蛞蝓; code>