在php中显示子菜单多菜单级别

时间:2017-07-02 08:47:04

标签: php

我正在尝试创建多菜单级别。 这是我的代码:

    MapQuickItem {
        id: yeahh
        sourceItem: Rectangle { width: 10; height: 10; color: "red"; border.width: 2; border.color: "blue"; smooth: true; radius: 15 }
        coordinate :src.position.coordinate
        opacity:1.0
        anchorPoint: Qt.point(sourceItem.width/2, sourceItem.height/2)
    }

显示如下:

function multi_menu($parentid = 0, $i = 0, $trees = null) {
        $j = 0;
        $model = ClassRegistry::init('TypeBrief');
        $types = $model->find('all', array('conditions' => array( 'TypeBrief.parent_id' => $parentid)));
        if(!$trees)
        {
           $trees = array();
        }
        foreach ($types as $key => $type) {
            $trees[] = array( 'id' => $type['TypeBrief']['id'], 'name' => ++$i.$type['TypeBrief']['name']);
            $trees = $this->multi_menu($type['TypeBrief']['id'], $i.'.'.$j++, $trees);
        }
        return $trees;
   }

但我希望显示如下:

1. Menu1

   1.1 Menu1.1

   1.1 Menu1.2

2. Menu2

我对变量j有疑问。它没有增加。

任何人都可以帮助我吗?

由于

0 个答案:

没有答案