简体   繁体   中英

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:

$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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM