本文介绍了Mailjet Vars空白数组抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$array = [
  "low_price_low_stock_goods" => []
]

在我的mailjet模板中

In my mailjet template

   {% for item in var:low_price_low_stock_goods %}
       <tr>
           <td>{{ item.good_name }}</td>
           <td>{{ item.value }}</td>
           <td>{{ item.count }}</td>
       </tr>
   {% endfor %}

错误现在没有值var:low_price_low_stock_goods / p>

error is now No value for "var:low_price_low_stock_goods"

推荐答案

当我 Ricky:Mailjet的模板语言方面是一个已知的问题,对不起。为了避免这种情况,只需在API调用中传递一个有效的对象 low_price_low_stock_goods值。这将工作:

As I answered you on Github Ricky: it's a known issue on Mailjet's templating language side, sorry for that. To avoid it, just pass a valid object in the API call for the low_price_low_stock_goods value. This will work:

{
  item.good_name: "",
  item.value: "",
  item.count: ""
}

这篇关于Mailjet Vars空白数组抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-25 04:33