Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 twig 并想检查给定变量 xyz 是否有超过 x 个条目。这怎么可能?
谢谢!
是的,长度过滤器是要走的路。
{% if xyz | length > x %} {% do something %} {% endif %}
好的,我认为 xyz|length 会起作用。