如何在从控制器发送的刀片模板中显示2d数组

时间:2016-01-27 14:00:01

标签: php laravel-5

Array
(
    [0] => Array
        (
            [0] => piya
            [1] => piya@gmail.com
            [2] => smting
            [3] => 1234567890
            [4] => gnfvjn
            [5] => 210
        )

    [1] => Array
        (
            [0] => dash
            [1] => dash@gmail.com
            [2] => smting
            [3] => 3213243547
            [4] => gnfvjn
            [5] => 211
        )

    [2] => Array
        (
            [0] => dash
            [1] => dash@gmail.com
            [2] => smting
            [3] => 3213243547
            [4] => gnfvjn
            [5] => 212
        )
)

如何显示此数组结构? 我一直在“试图获取非对象的属性”错误。

1 个答案:

答案 0 :(得分:-1)

因为它是2昏暗。数组,第一个foreach输出第二个数组(例如:['el1','el2'....])。然后第二个foreach输出字符串元素(例如:'el1','el2')

@foreach($array as $array2)
 @foreach($array2 as $value)
  {!! $value !!}
 @endforeach
@endforeach