gpt4 book ai didi

php - 如何从 stdclass 对象中获取数据?

转载 作者:可可西里 更新时间:2023-10-31 23:58:40 24 4
gpt4 key购买 nike

我在 codeigniter 中使用 $this->db->get_where() 从数据库中获取数据。它返回后我使用 print_r()

它看起来像stdClass 对象 的数组。任何知道如何访问此数组内的值的人。

Array ( [0] =>    
stdClass Object (
[id] => 1
[password321] => qwerty
[email123] => example@gmail.com
[username123] => xyz
)
)

最佳答案

它显示了一个对象数组。里面只有一个对象。

如果:

$var =  $this->db->get_where();

然后:

echo $var[0]->id;

关于php - 如何从 stdclass 对象中获取数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18324393/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com