大家好我试着在TWIG中做这样的事情
{% if app.request.get('_route') == 'route1' or 'route2' or 'route3' %}
我该怎么做?非常感谢你! :)
答案 0 :(得分:4)
您可以这样做:
{% if app.request.get('_route') in ['route1', 'route2', 'route3'] %}
更多:http://twig.sensiolabs.org/doc/templates.html#containment-operator