小编Bru*_*lva的帖子

返回数组以在laravel中查看

我有以下控制器,将此信息数组传递给我的视图

public function index ()
{
     public function index ()
     {
        $ information = [
        'nroclients' => '10',
        'nroservices' => '20',
        'nrousuers' => '30',
        'nroordensservices' => '40',
        ];
    
         return view ('dashboard.index', compact ('information'));
     }
}
Run Code Online (Sandbox Code Playgroud)

如何单独访问每个元素? index.blade.php

number of clients: {{information-> nroclients}} <br>
number of services: {{information-> nroservices}}
Run Code Online (Sandbox Code Playgroud)

这在我看来运行应该不起作用?

报告的错误是

(2/2)ErrorException试图获取非对象的属性(查看:C:\ wamp64\www\sistemtest\resources\views\panel\index.blade.php)

php laravel laravel-5

1
推荐指数
1
解决办法
1089
查看次数

标签 统计

laravel ×1

laravel-5 ×1

php ×1