Home > php教程 > php手册 > smarty模块的循环数组问题

smarty模块的循环数组问题

WBOY
Release: 2016-06-13 09:52:43
Original
1230 people have browsed it

D0000D发往论坛板块-------------------------------------------------------
No0 号板块 dedecms
D8888D贴子标题-------------------------------------------------------
smarty循环数组问题
D8888D主贴内容-------------------------------------------------------


用 Smarty 的 foreach如何取出里面的值? 难道一定得用section ??? Array( [productID] => 1

[productName] => 诺基亚 6220c

[attribute] => Array( [品牌] => Array( [1] => name2454542177524121 ))

)


复制代码

我来回答




D8888D回贴内容-------------------------------------------------------
用smarty里面的foreach语句不是也可以么。

D8888D回贴内容-------------------------------------------------------
用smarty里面的foreach语句不是也可以么。
Fising 发表于 2009-6-14 21:32 [url=http://www.phpchina.com/bbs/redirect.php?goto=findpost&pid=1067324&ptid=127997]链接标记[img]http://www.phpchina.com/bbs/images/common/back.gif[/img][/url]

产品名称:


不行....

D8888D回贴内容-------------------------------------------------------
产品名称:


不行....
一条尸体 发表于 2009-6-14 21:36 [url=http://bbs.phpchina.com/redirect.php?goto=findpost&pid=1067332&ptid=127997]链接标记[img]http://bbs.phpchina.com/images/common/back.gif[/img][/url]
怎可能

D8888D回贴内容-------------------------------------------------------
我试过了呀


附件: 您所在的用户组无法下载或查看附件
D8888D回贴内容-------------------------------------------------------
报错么

D8888D回贴内容-------------------------------------------------------
不报错,上面那个就是结果啊。产品名称为 1 .....

D8888D回贴内容-------------------------------------------------------
我X,诡异啊

D8888D回贴内容-------------------------------------------------------
仔细检查一下,肯定是哪里敲错了。foreach就是专门对付这个问题的。

D8888D回贴内容-------------------------------------------------------
Array ( [0] => Array ( [propertyName] => 品牌 ))
你说是针对这种吧?
这种是二唯数组来的,我现在说的那种是一唯关联数组


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template