简体   繁体   中英

Laravel laravelcollective/html textarea with unescaped html

I have a form made with the laravelcollective/html form package. Now I'd like to enter unescaped HTML Markup in a textarea:

<p>This is HTML-Markup text</p>

My form looks like this:

{!! Form::label('body', 'Body:') !!}
{!! Form::textarea('body' , null , ['class' => 'form-control']) !!}

I tried it with {{ }} but it still escapes the HTML in the textarea.

Also: Is there a way to limit the allowed HTML-Markups (probably with a regex ) ? Eg only <p>, <h1> and <div> and no <script> .

I'm using Laravel 5.2.

Thanks guys.

Try this {{!! !!}} {{!! !!}} for show result textarea

By default, Blade {{ }} statements are automatically sent through PHP's htmlentities function to prevent XSS attacks. If you do not want your data to be escaped, you may use the following syntax:

{!! $str!!}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM