PHP数组对象stdClass的 - 回波值 [英] PHP Array stdClass Object - Echo Value

查看:149
本文介绍了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] - >蛞蝓;

这篇关于PHP数组对象stdClass的 - 回波值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆