當(dāng)我在我的變量$veraplicacao上使用var_dump時,我得到的結(jié)果如下:object(Illuminate\Support\Collection)#351 (1) { ["items":protected]=> array(1) { [0]=> object(stdClass)#357 (11) { ["id"]=> int(1008) ["created_at"]=> NULL ["updated_at"]=> NULL ["nomeempresa"]=> string(11) "Teste teste" ["vagaaplicada"]=> string(6) "Testes" ["statusaplicacao"]=> int(4) ["pais"]=> string(6) "Brasil" ["estado"]=> string(16) "Distrito Federal" ["cidade"]=> string(12) "Plano Piloto" ["textocompleto"]=> string(16) "Teste 123" ["deleted_at"]=> NULL } }}我怎么能只得到“諾米姆普雷薩”值?當(dāng)我嘗試時,我得到以下錯誤:$veraplicacao["nomeempresa"]Undefined index: nomeempresa當(dāng)我嘗試時,我得到以下錯誤:$veraplicacao->nomeempresa屬性 [無名名]在此集合實例上不存在。當(dāng)我嘗試時,我得到以下錯誤:$veraplicacao->nomeempresa不能使用 stdClass 類型的對象作為數(shù)組
1 回答
大話西游666
TA貢獻1817條經(jīng)驗 獲得超14個贊
要獲取您所需的屬性,可以先使用():
$veraplicacao->first()->nomeempresa;
有關(guān)集合的更多信息,我建議查看文檔。
或者,由于集合實現(xiàn)了數(shù)組訪問,因此您只需使用數(shù)組中值的索引:
$veraplicacao[0]->nomeempresa;
- 1 回答
- 0 關(guān)注
- 137 瀏覽
添加回答
舉報
0/150
提交
取消
