Laravel 5: Display HTML with Blade

后端 未结 20 2396
栀梦
栀梦 2020-11-22 16:21

I have a string returned to one of my views, like this:

$text = \'

Lorem ipsum dolor

20条回答
  •  孤独总比滥情好
    2020-11-22 16:36

    If you want to escape the data use

    {{ $html }}
    

    If don't want to escape the data use

    {!! $html !!}
    

    But till Laravel-4 you can use

    {{ HTML::link('/auth/logout', 'Sign Out', array('class' => 'btn btn-default btn-flat')) }}
    

    When comes to Laravel-5

    {!! HTML::link('/auth/logout', 'Sign Out', array('class' => 'btn btn-default btn-flat')) !!} 
    

    You can also do this with the PHP function

    {{ html_entity_decode($data) }}
    

    go through the PHP document for the parameters of this function

    html_entity_decode - php.net

提交回复
热议问题