Laravel 框架中的火基并从 DB 获取此信息
Posted
技术标签:
【中文标题】Laravel 框架中的火基并从 DB 获取此信息【英文标题】:fire base in Laravel frame work and got this information from DB 【发布时间】:2018-08-21 14:18:03 【问题描述】:我在 Laravel 框架中使用 fire base 并从 DB 获得此信息
array:8 [▼
"5cR0IIftjJaGH3Zlt1SWix3HO2j2" => array:14 [▼
"birthDay" => ""
"bumpAvailable" => true
"bumpLimit" => 10
"bumpRecived" => 2
"bumpSend" => 8
"fact" => "Nasser ali karimi"
"firstName" => "Nasser"
"gender" => "male"
"lastName" => "Karimi"
"notification" => true
"phoneNumber" => ""
"photoUrl" => ""
"socialMedia" => array:3 [▼
"facebook" => ""
"instagram" => ""
"snapchat" => ""
]
"uid" => "5cR0IIftjJaGH3Zlt1SWix3HO2j2"
]
"8iHDZBWsn9NCIvdeG1eaLj2IBi63" => array:10 [▶]
"A8TDVhfrBTcMIkP4qiompVtF5R82" => array:10 [▶]
"CNqX0C7R4Jfv3kM7I1stNtR92kt2" => array:11 [▶]
"SgsR2Xr55abGiqGu9UMgrPwFoAv1" => array:15 [▶]
"axMw79EtZnXZq25b0taIRii8Qnl1" => array:13 [▶]
"f7AHT2FnXiVtuzOQipAuYSBEH7f2" => array:14 [▶]
"p2A9GEinF3de4saRKfLA5Ur510u1" => array:10 [▶]
]
但是我怎样才能展示我想要的每个部分呢? 例如,我如何显示名字? 以及如何显示 facebook?
【问题讨论】:
您只需要一个特定条目的信息吗?还是要显示所有返回的整体? 我想为所有用户显示一次姓名和性别。 【参考方案1】:您可以简单地使用 foreach 循环来遍历所有结果:
foreach($results as $user)
echo $user['firstName'];
echo $user['lastName'];
echo $user['gender'];
【讨论】:
以上是关于Laravel 框架中的火基并从 DB 获取此信息的主要内容,如果未能解决你的问题,请参考以下文章