我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在树枝模板中使用in_array和isset?

This part:

<?php if (isset($quantity_taxation_curr) && in_array($currency['code'], $quantity_taxation_curr)) { ?>

to become in twig format, i tried with this one:

{% if isset(quantity_taxation_curr) AND in_array(currency['code'], quantity_taxation_curr) %}

But it's not correct.

Try this:

{% if quantity_taxation_curr is defined and currency['code'] in quantity_taxation_curr %}

Try this out

{% if quantity_taxation_curr is defined and 'code' in quantity_taxation_curr %}
...
{% endif %}

近期文章

  • Centos 使用rpm安装jdk出现错误:解压压缩文件
  • window.open
  • 这句代码的作用是什么?
  • 刚学linux还不咋会
  • find 后调用 -exec 执行多条语句的方法是?
  • 导致码间串扰的确切定义是什么?
  • Matlab坐标对数化
  • 说明与非门逻辑符语描述与非门的VHDL基本设计单元各部分之间的对应关。
  • Laravel您要求1件物品,但只有0件物品可用
  • Win10提问,电脑变卡检查电脑时候发现的
  • 学软件工程能找什么工作
  • 软件示波器Virtual Oscilloscope未取得一个有效通信通道
  • 用request请求数据,response:200,但是显示网络繁忙,试过代理池,没用;要怎么解决这个问题,有知道原因吗?
  • js执行结果疑问,需要解答
  • python输入问题
  • AttributeError: type object 'Blog' has no attribute 'bojects'
  • R怎样导入100g內存的多个excel文件?
  • Python 根据指定行数拆分原数据
  • too long
  • C++二进制兼容dll

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华