Laravel 消息中的换行符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41631436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:06:59 来源:igfitidea点击:
Laravel line break in message
提问by utdev
How do I do a line break in a message.
如何在消息中进行换行。
I tried following
我试过跟随
$request->session()->flash('message', "first line \r\n second line");
$request->session()->flash('message', "first line <br> second line");
but they did not work, how do I accomplish this?
但他们没有工作,我该如何做到这一点?
回答by Alexey Mezenin
Use <br>
but when displaying the messages, use unescaped echoing:
使用<br>
但显示消息时,使用未转义的回显:
{!! session('message') !!}
回答by AddWeb Solution Pvt Ltd
You can try:
你可以试试:
{!! 'first line <br> second line' !!}
Output
输出
first line
second line
And
和
{!! nl2br(e('first line <br> second line')) !!}
Output
输出
first line <br> second line
回答by Niklesh Raut
Displaying Unescaped Data in laravel like this.
像这样在 Laravel 中显示未转义的数据。
{!! $message !!}