树枝 - 不要转义'&' [英] Twig - Do Not Escape '&'

查看:32
本文介绍了树枝 - 不要转义'&'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 <meta> 标签中使用转义树枝过滤器 e 转义字符,以防它们包含会破坏标签的引号.问题是它正在转义和 & 字符.我想知道是否有办法不逃避和签名?

I am escaping characters using the escape Twig filter e in my <meta> tag in-case they contain quotations which will break the tag. The issue is that it is escaping the and & character. I am wondering if there is a way to not escape the and sign?

推荐答案

你总是可以使用替换作为一个黑客修复 ;)

you could always just use replace as a hack fix ;)

description|e|replace({'\&':'&'})

这篇关于树枝 - 不要转义'&amp;'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆