我的阵列看起来像这样:Array ( [seller1] => Array ( [0] => Array ( [reference] => seller1 [name] => Lime verder [unit_price] => 44,00 $ [price] => 26,40 $ [quantity] => 0.6 [customization] => Array ( ) ) [1] => Array ( [reference] => seller1 [name] => Banane [unit_price] => 12,00 $ [price] => 12,00 $ [quantity] => 1 [customization] => Array ( ) ) ) [seller2] => Array ( [0] => Array ( [reference] => seller2 [name] => qiwi [unit_price] => 33,00 $ [price] => 16,50 $ [quantity] => 0.5 [customization] => Array ( ) ) [1] => Array ( [reference] => seller2 [name] => Banane [unit_price] => 25,00 $ [price] => 12,50 $ [quantity] => 0.5 [customization] => Array ( ) ) [2] => Array ( [reference] => seller2 [name] => Porotocale [unit_price] => 32,00 $ [price] => 48,00 $ [quantity] => 1.5 [customization] => Array ( ) ) ) [seller3] => Array ( [0] => Array ( [reference] => seller3 [name] => portocale [unit_price] => 21,00 $ [price] => 21,00 $ [quantity] => 1 [customization] => Array ( ) ) [1] => Array ( [reference] => seller3 [name] => Babana [unit_price] => 26,00 $ [price] => 52,00 $ [quantity] => 2 [customization] => Array ( ) ) ) ) 1但我得到空行作为输出。在同一个 *tpl 文件中,还有另一个 foreach 循环,它看起来与我的不同:{foreach $list as $product}跟smarty版本有关系吗?
1 回答
素胚勾勒不出你
TA贡献1827条经验 获得超9个赞
版本 2 中的语法{foreach}
(在版本 3 中仍然受支持)对key=
和item=
参数使用字符串值。所以你必须改变你的{foreach}
循环:
{foreach from=$sellerProducts key=seller item=products} ... {/foreach}
- 1 回答
- 0 关注
- 109 浏览
添加回答
举报
0/150
提交
取消