<tfoot id='c5E4U'></tfoot>
    <bdo id='c5E4U'></bdo><ul id='c5E4U'></ul>

      <legend id='c5E4U'><style id='c5E4U'><dir id='c5E4U'><q id='c5E4U'></q></dir></style></legend>
      1. <i id='c5E4U'><tr id='c5E4U'><dt id='c5E4U'><q id='c5E4U'><span id='c5E4U'><b id='c5E4U'><form id='c5E4U'><ins id='c5E4U'></ins><ul id='c5E4U'></ul><sub id='c5E4U'></sub></form><legend id='c5E4U'></legend><bdo id='c5E4U'><pre id='c5E4U'><center id='c5E4U'></center></pre></bdo></b><th id='c5E4U'></th></span></q></dt></tr></i><div id='c5E4U'><tfoot id='c5E4U'></tfoot><dl id='c5E4U'><fieldset id='c5E4U'></fieldset></dl></div>

        <small id='c5E4U'></small><noframes id='c5E4U'>

        Laravel 在 Blade 模板中转义所有 HTML

        时间:2023-10-31

          • <bdo id='ZzuKL'></bdo><ul id='ZzuKL'></ul>

            1. <small id='ZzuKL'></small><noframes id='ZzuKL'>

                <tbody id='ZzuKL'></tbody>

                <legend id='ZzuKL'><style id='ZzuKL'><dir id='ZzuKL'><q id='ZzuKL'></q></dir></style></legend>
              • <i id='ZzuKL'><tr id='ZzuKL'><dt id='ZzuKL'><q id='ZzuKL'><span id='ZzuKL'><b id='ZzuKL'><form id='ZzuKL'><ins id='ZzuKL'></ins><ul id='ZzuKL'></ul><sub id='ZzuKL'></sub></form><legend id='ZzuKL'></legend><bdo id='ZzuKL'><pre id='ZzuKL'><center id='ZzuKL'></center></pre></bdo></b><th id='ZzuKL'></th></span></q></dt></tr></i><div id='ZzuKL'><tfoot id='ZzuKL'></tfoot><dl id='ZzuKL'><fieldset id='ZzuKL'></fieldset></dl></div>
                <tfoot id='ZzuKL'></tfoot>
                  本文介绍了Laravel 在 Blade 模板中转义所有 HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在 Laravel 中构建一个小型 CMS,并尝试显示内容(存储在数据库中).它显示 HTML 标签而不是执行它们.就像所有打印数据都有一个自动 html_entity_decode 一样.

                  I'm building a small CMS in Laravel and I tried to show the content (which is stored in the DB). It is showing the HTML tags instead of executing them. Its like there is an auto html_entity_decode for all printed data.

                  <?php
                  
                  class CmsController extends BaseController
                  {
                      public function Content($name)
                      {    
                          $data = Pages::where('CID', '=', Config::get('company.CID'))
                              ->where('page_name', '=', $name)
                              ->first();
                  
                          return View::make('cms.page')->with('content', $data);
                      }
                  }
                  

                  我尝试使用花括号打印内容.

                  I tried to print the content using the curly brace.

                  {{ $content->page_desc }}
                  

                  和三重花括号.

                  {{{ $content->page_desc }}}
                  

                  他们给出了相同的结果.我需要执行那些 HTML 标签而不是转义它们.

                  And they give the same result. I need to execute those HTML tags instead of escaping them.

                  推荐答案

                  将语法从 {{ }} 更改为 {!!!!}.

                  Change your syntax from {{ }} to {!! !!}.

                  正如 Alpha 在上面的评论中所说(不是答案,所以我想我会发布),在 Laravel 5 中,{{ }}(以前是非转义的输出语法)已经改变到 <代码>{!!!!}.将 {{ }} 替换为 {!!!!} 它应该可以工作.

                  As The Alpha said in a comment above (not an answer so I thought I'd post), in Laravel 5, the {{ }} (previously non-escaped output syntax) has changed to {!! !!}. Replace {{ }} with {!! !!} and it should work.

                  这篇关于Laravel 在 Blade 模板中转义所有 HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:laravel compact() 和 -&gt;with() 下一篇:更改 Laravel 的 created_at 和 updated_at 的名称

                  相关文章

                  <legend id='IhQdr'><style id='IhQdr'><dir id='IhQdr'><q id='IhQdr'></q></dir></style></legend>
                    <tfoot id='IhQdr'></tfoot>

                    1. <small id='IhQdr'></small><noframes id='IhQdr'>

                        <bdo id='IhQdr'></bdo><ul id='IhQdr'></ul>
                      <i id='IhQdr'><tr id='IhQdr'><dt id='IhQdr'><q id='IhQdr'><span id='IhQdr'><b id='IhQdr'><form id='IhQdr'><ins id='IhQdr'></ins><ul id='IhQdr'></ul><sub id='IhQdr'></sub></form><legend id='IhQdr'></legend><bdo id='IhQdr'><pre id='IhQdr'><center id='IhQdr'></center></pre></bdo></b><th id='IhQdr'></th></span></q></dt></tr></i><div id='IhQdr'><tfoot id='IhQdr'></tfoot><dl id='IhQdr'><fieldset id='IhQdr'></fieldset></dl></div>