Twig之判断字符串是否在字符串中
2020-06-22 本文已影响0人
Cute_小肥鸡
{% if '需要查询的字符串' in '字符串' %}
例如:判断 “BK” 是否在 “BK_2_4_01_01”,在的话,显示页面;不在的话,隐藏页面。
<div class="comm-row comm-form-item {% if 'BK' in TPInfo['classificationCode'] %} {% else %}hide{% endif %}" >
</div>