List all registered variables inside a Laravel view

前端 未结 5 1461
故里飘歌
故里飘歌 2020-12-12 19:09

I am using Laravel 5. I would like to know which are all variables passed to a view inside the view itself.

Since all variables are in the view scope I thought I cou

5条回答
  •  清歌不尽
    2020-12-12 19:40

    Use the dd helper:

    {{ dd(get_defined_vars()) }}
    

    Read more: https://laravel.com/docs/5.4/helpers#method-dd

    Update (thx, @JoeCoder): you can further cutdown on the "useless" variables by doing:

    {{ dd(get_defined_vars()['__data']) }}
    

提交回复
热议问题