如果 symfony 上的可变树枝 [英] if variable twig on symfony

查看:23
本文介绍了如果 symfony 上的可变树枝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对select标签multiple选中的值做一个测试.我尝试使用此代码,但出现此错误:

I would like to do a test on the values ​​selected by the select tag multiple. I tried with this code, but I get this error:

哈希键必须是带引号的字符串、数字、名称或括号中的表达式(AdminBlogBu​​ndle:GestionGraph:graphkpi1.html.twig 第 575 行中值{"的意外标记标点符号")>

A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{" in AdminBlogBundle:GestionGraph:graphkpi1.html.twig at line 575

{% for liste in Col1_Array %}
    {% if {{liste}} is "Call Drop" %}
     <div id="chartdiv" style="width: 100%; height: 400px;"></div>
    {% else %}
      <div id="chartdiv1" style="width: 100%; height: 400px;"></div>
    {% endif %}
{% endfor %}

谁能帮帮我?

推荐答案

不能嵌套这样的分隔符.

You can't nest delimeters like that.

正确的语法是:

{% if liste == "Call Drop" %}

这篇关于如果 symfony 上的可变树枝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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