Laravel foreach数组视图

时间:2017-11-15 03:08:40

标签: php laravel

你好,我有这样的数组,你能帮我看看如何查看。

array(2){   [0] =>   string(1)“2”   [1] =>   string(2)“19” }

1 个答案:

答案 0 :(得分:3)

如果您有这样的数组:

$array = ["2", "19"];

您可以使用刀片模板引擎查看它,如下所示:

@foreach($array as $item)
  {{$item}}
@endforeach

如果你只是想在普通的PHP中访问它,虽然它会像:

foreach($array as $item) {
  echo $item;
  // or whatever you want to do with the information here
}

这是你想要做的吗?