开发者

How to access data in object(stdClass) returned from query in joomla?

I'm trying to get data from sql query using Joomla 开发者_StackOverflow中文版api, when I loop through results returning from query using for each I tried to access the object properties using this:

$opt->id

I got nothing now I tried to var_dump the variable $opt and got the following

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.

Thanks


Try using get_object_vars(); http://us3.php.net/manual/en/function.get-object-vars.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜