smarty模板解析数组有关问题

WBOY
Release: 2016-06-13 10:18:17
Original
804 people have browsed it

smarty模板解析数组问题

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->array (  'id' => 1,  'pid' => 0,  'name' => '一级1',  'child' =>   array (    2 =>     array (      'id' => 2,      'pid' => 1,      'name' => '二级11',    ),    3 =>     array (      'id' => 3,      'pid' => 1,      'name' => '二级12',    ),    9 =>     array (      'id' => 9,      'pid' => 1,      'name' => '二级13',      'child' =>       array (        4 =>         array (          'id' => 4,          'pid' => 9,          'name' => '三级11',          'child' =>           array (            5 =>             array (              'id' => 5,              'pid' => 4,              'name' => '四级13',            ),            7 =>             array (              'id' => 7,              'pid' => 4,              'name' => '四级11',            ),            8 =>             array (              'id' => 8,              'pid' => 4,              'name' => '四级12',              'child' =>               array (                10 =>                 array (                  'id' => 10,                  'pid' => 8,                  'name' => '五级分类',                  'child' =>                   array (                    11 =>                     array (                      'id' => 11,                      'pid' => 10,                      'name' => '六级分类',                    ),                  ),                ),              ),            ),          ),        ),        6 =>         array (          'id' => 6,          'pid' => 9,          'name' => '三级21',        ),      ),    ),  ),)
Copy after login


这种数组在smarty里怎么做处理成树状结构??

------解决方案--------------------
是用JS做的吧,如果smarty能做,那么PHP就能
------解决方案--------------------
我想知道干嘛
------解决方案--------------------
smarty2 不可以
smarty3 可以,模板中又递归函数
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!