laravel 5.5刀片有时会抛出损坏的html作为输出

时间:2018-12-05 03:31:39

标签: php laravel laravel-blade

预期的输出(大部分时间显示)

<li class="m-menu__item  m-menu__item--active " aria-haspopup="true"  data-menu-submenu-toggle="hover">
        <a  href="http://127.0.0.1:8000/invoices" class="m-menu__link m-menu__toggle">
            <i class="m-menu__link-icon flaticon-clipboard"></i>
            <span class="m-menu__link-text">
                Invoices
            </span>
        </a>
    </li>

HTML损坏(有时抛出带有损坏标签的输出)

<li class="m-menu__item  m-menu__item--active " aria-haspopup="true"  data-menu-submenu-toggle="hover">
            <a  href="http://127.0.0.1:8000/invoices" class="m-menu__link m-menu__toggle">
                <i class="m-menu__link-icon flaticon-clipboard"></i>
                <s                </span>
            </a>
        </li>

刀片代码

<li class="m-menu__item @if(isset($sidebar) && $sidebar == 'invoice') m-menu__item--active @endif" aria-haspopup="true"  data-menu-submenu-toggle="hover">
        <a  href="{{ asset('invoices') }}" class="m-menu__link m-menu__toggle">
            <i class="m-menu__link-icon flaticon-clipboard"></i>
            <span class="m-menu__link-text">
                Invoices
            </span>
        </a>
    </li>

尝试启用错误,记录禁用缓存,但仍然没有运气 刀片渲染是否存在错误

1 个答案:

答案 0 :(得分:0)

尝试改善您的代码,但可能无法修复该错误。

<li class="m-menu__item {{ isset($sidebar) && $sidebar == 'invoice' ? 'm-menu__item--active' : '' }}" aria-haspopup="true"  data-menu-submenu-toggle="hover">
    <a  href="{{ url('/invoices') }}" class="m-menu__link m-menu__toggle">
        <i class="m-menu__link-icon flaticon-clipboard"></i>
        <span class="m-menu__link-text">
            Invoices
        </span>
    </a>
</li>

仅使用asset()函数加载资产文件(JS,CSS,图像)

在锚点上使用url('uri'),甚至更好地使用route('route-name')