How to echo a default value if value not set blade

前端 未结 6 1251
迷失自我
迷失自我 2020-12-13 08:31

I would like to know what would be the best way to display a default value if the given value is not set. I have the following in a blade file (I can not guaranty that the k

6条回答
  •  遥遥无期
    2020-12-13 09:02

    Since Laravel 5.7 {{$Variable or "Default Message"}} throws $Variable is not defined. This {{$Variable ?? "Default Message"}} works though.

提交回复
热议问题