array( array('categ"/> array( array('categ">
Rumah >pembangunan bahagian belakang >tutorial php > 请array表现为面包屑
请求一个array表现为面包屑?
我有这样一个数组,
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> $a= array( array('category' => array('name'=>"第一级"),'children' => array( array('category' => array('name'=>"第二级"),'children' => array( array('category' => array('name'=>"第三级") ) ) ) ) ) ) ;
$a = array( array('category' => array('name'=>"第一级"),'children' => array( array('category' => array('name'=>"第二级"),'children' => array( array('category' => array('name'=>"第三级") ) ) ) ) ) ); function Breadcrumbs($ar) { foreach($ar as $row) { if(isset($row['category'])) echo $row['category']['name']; if(isset($row['children'])) { echo ' '; Breadcrumbs($row['children']); } } } Breadcrumbs($a); <div class="clear"> </div>