我正在尝试创建一个包含无限深度类别的选择框,子类别选择框。我有一个包含无限类别子类别深度的数组,如下所示,
Array
(
[0] => Array
(
[id] => 6
[cata_key] => 32e9c75e38d2a1d77b2b49b2
[cata_name] => Road
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 0
[subcategories] => Array
(
[0] => Array
(
[id] => 9
[cata_key] => 780c3eb53264d5c33a26d49f
[cata_name] => Cars
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 6
[subcategories] => Array
(
[0] => Array
(
[id] => 10
[cata_key] => 111cd06b1575457f665d460e
[cata_name] => Hyundai
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 9
[subcategories] => Array
(
)
)
[1] => Array
(
[id] => 11
[cata_key] => 26ca0e1622c11ed2628eaadf
[cata_name] => Maruthi
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 9
[subcategories] => Array
(
)
)
)
)
[1] => Array
(
[id] => 16
[cata_key] => 49973084640af71ad61e634b
[cata_name] => Bikes
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 6
[subcategories] => Array
(
)
)
)
)
[1] => Array
(
[id] => 7
[cata_key] => 56bae4297efcbf796b230a99
[cata_name] => River
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 0
[subcategories] => Array
(
[0] => Array
(
[id] => 12
[cata_key] => 7fc72e49fe67d0b777648f54
[cata_name] => Boat
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 7
[subcategories] => Array
(
[0] => Array
(
[id] => 14
[cata_key] => 38c749056a9f583e284e509b
[cata_name] => 2 Seater
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 12
[subcategories] => Array
(
)
)
[1] => Array
(
[id] => 15
[cata_key] => 6ebfcad4d4e05e84d333b7e5
[cata_name] => 10 Seater
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 12
[subcategories] => Array
(
)
)
)
)
[1] => Array
(
[id] => 13
[cata_key] => b6125c73f6d7c153f45e133e
[cata_name] => Ship
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 7
[subcategories] => Array
(
)
)
)
)
[2] => Array
(
[id] => 8
[cata_key] => 1c748603f36105b921b54165
[cata_name] => Air
[app_key] => b80e0935b348da61b2a807ff
[parentid] => 0
[subcategories] => Array
(
)
)
)
我想在 tpl 中创建一个选择框,供访问者选择正确的类别/子类别。提前致谢