被騙了很久..發現到原來是這樣
在controller的設定上,有兩個參數帶到前面
$this->view->setVar(“zipCode”,$Arry);
$this->view->setVar(“pay”, $payObj);
然而在volt的view顯示時,卻要用兩種不同的方式處理
這個是陣列的用法
1 2 3 | {% for rowGroup in memberGroupList %} <option value="{{ rowGroup["id"] }}"> {{ rowGroup["zipcode"] }}</option> {% endfor %} |
這個是物件的用法
1 2 3 4 5 6 7 | {% for row in pay.data %} <tr> <td class="text-center"> {{ row.productName}} </td> </tr> {% endfor %} |