我在Laravel中使用TwigBridge包(barryvdh/laravel-twigbridge
)。一切都工作正常,但当我尝试使用Twig模板渲染分页链接时,输出原始HTML。我写了links
电话如下:
{{ users.links('includes.paginate') }}
我在app/views/includes/paginate.twig
处有一个模板文件。
我必须更改或添加一些配置吗?
答案 0 :(得分:2)
我不熟悉那个软件包(我使用的是rcrowe的软件包),但我看到looking at its config文件:
'options' => array(
'autoescape' => 'html',
)
* autoescape: Whether to enable auto-escaping (default to html):
| * false: disable auto-escaping
| * true: equivalent to html
| * html, js: set the autoescaping to one of the supported strategies
| * PHP callback: a PHP callback that returns an escaping strategy based on the template "filename"
一个糟糕的解决方案是关闭自动转移,但这可能是全局性的,它可能会以您赢得的方式影响您的应用。您是否尝试使用raw Twig过滤器?
{{ users.links('includes.paginate')|raw }}