twig - Twig - 如果数组中的数组值之一
问题描述
我尝试做这样的事情,有人知道如何处理吗?
这是我目前拥有的:
{{ ('1' in app.request.pathInfo or '2' in app.request.pathInfo or '3' in app.request.pathInfo) ? 'active' : '' }} X
这就是我要的 :
{{ (['1','2','3'] in app.request.pathInfo) ? 'active' : '' }} V
解决方案
逆逻辑有效;)
{{ app.request.pathInfo in ['frame_brand', 'frame_elevation', 'frame_model'] ? 'active' }}
推荐阅读
- python-3.x - 如何使用 Python3 opencv 捕获 mpeg-dash 流?
- mysql - 如何将两个 SQL 表的数据合并到一个新的 SQL 表中?
- python - 每个用户 Django 一个模型对象
- python - 处理 OS 错误 Python:[Errno 20] 不是目录:'/Volumes/ARLO/ADNI/.DS_Store'
- java - Java - 拆分和替换文本文件中的某些数据
- node.js - 将控制台记录到电子文件中
- javascript - vue.js:如何用对象更新状态?
- reactjs - 使用 redux 多组件反应路由器
- python-3.x - scipy模块未找到错误
- c#-4.0 - 如何克服此错误“Vehicle.CreateObject(int, string, int, string)”:并非所有代码路径都返回值