使用 blade 将数据库中的 html 文本格式化为 Laravel
Format html text from database to Laravel with blade
在数据库中,一个字段以 html 文本格式保存,例如:
<p>Esto es un <strong>mensaje </strong>de prueba</p>
当我在 blade 的屏幕上显示它时,出现了标签,但它没有格式化它。
有人知道怎么格式化吗?
我试过了
<p>{{$notification->message}}</p>
{{$notification->message}}
显示:
<p>Esto es un <strong>mensaje </strong>de prueba</p>
但我想要这样:
Esto es un mensaje de prueba
要显示未转义的数据,请使用 {!! $$notification->message !!}
参考https://laravel.com/docs/9.x/blade#displaying-unescaped-data
在数据库中,一个字段以 html 文本格式保存,例如:
<p>Esto es un <strong>mensaje </strong>de prueba</p>
当我在 blade 的屏幕上显示它时,出现了标签,但它没有格式化它。
有人知道怎么格式化吗?
我试过了
<p>{{$notification->message}}</p>
{{$notification->message}}
显示:
<p>Esto es un <strong>mensaje </strong>de prueba</p>
但我想要这样:
Esto es un mensaje de prueba
要显示未转义的数据,请使用 {!! $$notification->message !!}
参考https://laravel.com/docs/9.x/blade#displaying-unescaped-data