我正在运行这个查询
$results = DB::connection('selection')
->select("
SELECT id, name, email
FROM users
WHERE email = $this->email
");
我希望只能得到结果,我确实得到了,这是我的输出
array:1 [
0 => {
+"id": 1
+"name": "Ted Wood"
+"email": "tedwood@email.com"
}
]
我想知道的是如何访问name而不需要做$results[0]->name我想做的事情$results->name。
因为我只得到 1 项,所以我认为不需要 foreach 循环
ibeautiful
青春有我
catspeake