LoginSignup
6
7

More than 3 years have passed since last update.

【Laravel】Blade上で、配列をdump()するときは、dd()

Last updated at Posted at 2018-10-31

blade上で配列を@foreachで回してその配列の中身の変数を確認したいときは、
foreach()する手前で、dd()で確認しましょう。

LaravelのBlade上で、{{ dump(['a', 'b']) }}とすると、
以下エラー発生します。

htmlspecialchars() expects parameter 1 to be string, array given (View:ファイル名) 

配列を頑張ってエスケープしようとしてるのでエラーになるみたいです。

頑張ってdump()しようとして

@php
   dump(['a', 'b']);
@endphp

してました。

非常に恥ずかしい記事を書いてしまったが自分の知見になったので良しとする。。

6
7
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7