How do I use nl2br() in Laravel 5 Blade

前端 未结 4 1761
心在旅途
心在旅途 2021-02-02 08:57

So I want to keep linebreaks from the database while using the Blade Template Engine. I came up on the idea using

{!! nl2br(e($task->text)) !!}
4条回答
  •  春和景丽
    2021-02-02 09:25

    Simple approach which works for Laravel 4 + Laravel 5.

    {!! nl2br(e($task->text)) !!}
    

提交回复
热议问题