[英]How to access data in object(stdClass) returned from query in joomla?
I'm trying to get data from sql query using Joomla api, when I loop through results returning from query using for each I tried to access the object properties using this: 我试图使用Joomla api从sql查询中获取数据,当我遍历查询返回的结果时,我尝试使用以下方法访问对象属性:
$opt->id
I got nothing now I tried to var_dump the variable $opt and got the following 现在我什么也没得到,我尝试var_dump变量$ opt并得到以下内容
object(stdClass)[172] public 'id' => string '1' (length=1) public 'name' => string '2011' (length=4)
How could I access the id and name property of this object. 如何访问此对象的id和name属性。
Thanks 谢谢
Try using get_object_vars(); 尝试使用get_object_vars(); http://us3.php.net/manual/en/function.get-object-vars.php
http://us3.php.net/manual/zh/function.get-object-vars.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.