Twig 谷歌双引号制造问题
我在twig中使用了replace函数来删除函数中不需要的部分,它工作得很好,只是仍然包含双引号。 代码如下:Twig 谷歌双引号制造问题,twig,Twig,我在twig中使用了replace函数来删除函数中不需要的部分,它工作得很好,只是仍然包含双引号。 代码如下: {% set htmlheader = sd_htmltitle(false) %} <title> {{ htmlheader|replace({'brand:': "", "websitesub:" : "", "websitecategory:" : "", '"' : ''}) }} </title> {%set-htmlheader=sd\u-
{% set htmlheader = sd_htmltitle(false) %}
<title>
{{ htmlheader|replace({'brand:': "", "websitesub:" : "", "websitecategory:" : "", '"' : ''}) }}
</title>
{%set-htmlheader=sd\u-htmltitle(false)%}
{{htmlheader}替换({'brand:':'',“websitesub::'',“websitegority::'','':'}}}
如您所见,我尝试替换引号,但它们仍然出现在标题中。您是否有解决方案,或者可能有更好的方法来处理这种情况(如果适用)?其他所有内容都已正确删除
谢谢!您应该在引号前添加一个
\
。请尝试以下操作:
{{ htmlheader|replace({'brand:': "", "websitesub:" : "", "websitecategory:" : "", '\"' : ''}) }}
一个有效的例子
希望获得此帮助您应该在引号前添加一个
\
。因此请尝试以下操作:
{{ htmlheader|replace({'brand:': "", "websitesub:" : "", "websitecategory:" : "", '\"' : ''}) }}
一个有效的例子
希望这有助于TY Matteo利用业余时间帮助像我这样的傻瓜。您好@kumbi1不客气!帮助别人是我的荣幸,不要担心Matteo利用业余时间帮助像我这样的傻瓜。您好@kumbi1不客气!帮助别人是我的荣幸,不用担心