문제
I can't find a way to have TWIG interpret the following conditional statement:
{% if a == true or b == true %}
do stuff
{% endif %}
Am I missing something or it's not possible?
해결책
다른 팁
Comparison expressions should each be in their own brackets:
{% if (a == 'foo') or (b == 'bar') %}
...
{% endif %}
Alternative if you are inspecting a single variable and a number of possible values:
{% if a in ['foo', 'bar', 'qux'] %}
...
{% endif %}
제휴하지 않습니다 StackOverflow