Currently I have a stdclass object. How can I access the properties of the object such as the name of the author? I have tried to echo out $authors = $book->authors_summary[0]->name;
but it returns 'Trying to get property of non-object in ...' error.
[authors_summary] => Array
(
[0] => Array
(
[id] => 123456789
[name] => Ben Smith
)
[1] => Array
(
[nconst] => 987654321
[name] => Tommy Lee
)
)
authors_summary[0]
是一个数组,因此不能使用->
对象指针,必须将其称为数组:
$authors = $book->authors_summary[0]['name'];
'name' is the key of array so you may access name value like this
$authors = $book->authors_summary[0]['name'];
echo $authors;
Array ( [data] => Array ( [0] => stdClass Object ( [Id] => 5 [Name] => nilu [Email] => nilu@gmail.com [Password] => nilu [Image] => LOVE_A_O_D.jpg )
)
)
how to fetch password from this..... in controller---- $datas['data']= $this->Login_model->loginchk($value);
in model----- $results=$this->db->get(); return $results->result();
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.