Smarty的:如何参照关联数组的索引 [英] Smarty: How to reference to the associative array index

查看:116
本文介绍了Smarty的:如何参照关联数组的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Array $imagelist:

Array ( 
    [additional] => Array ( 
    	[count] => 2 
    	[image] => Array ( 
    		[nokia_e61_1.jpg] => Array ( 
    			[name_body] => nokia_e61_1 
    			[name_ext] => jpg 
    		) 
    		[nokia_e61_2.jpg] => Array ( 
    			[name_body] => nokia_e61_2 
    			[name_ext] => jpg 
    		) 
    		[nokia_e61_3.jpg] => Array ( 
    			[name_body] => nokia_e61_3 
    			[name_ext] => jpg 
    		) 
    		[nokia_e61_4.jpg] => Array ( 
    			[name_body] => nokia_e61_4 
    			[name_ext] => jpg 
    		) 
    	) 
    ) 
    [main] => nokia_e61 
)

nokia_e61_1.jpg 保存在 {$ getvars.imagename}

我写了 {$ imagelist.additional.image` $ getvars.imagename&#x60的; .name_body} ,但它不能正常工作。

I wrote {$imagelist.additional.image.`$getvars.imagename`.name_body} but it doesn't work.

请帮忙。

推荐答案

看看 {$ imagelist.additional.image [$ getvars.imagename] .name_body}

这篇关于Smarty的:如何参照关联数组的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆