Heim  >  Artikel  >  Backend-Entwicklung  >  smarty模块的循环数组问题_PHP教程

smarty模块的循环数组问题_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:51:15949Durchsuche

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] => 品牌 ))
你说是针对这种吧?
这种是二唯数组来的,我现在说的那种是一唯关联数组


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632572.htmlTechArticleD0000D发往论坛板块------------------------------------------------------- No0 号板块 dedecms D8888D贴子标题------------------------------------------------------- smart...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn