我的复选框示例http://jsfiddle.net/8PVZ5/1/
当我检查sizes
输出将是这样的
如果我检查了两个或多个变体,我可以将它们组合成这样。
我的数组输出
Array
(
[0] => Array
(
[id] => 1
[name] => Sizes
[parent] => 0
[children] => Array
(
[0] => Array
(
[id] => 2
[name] => S
[parent] => 1
)
[1] => Array
(
[id] => 3
[name] => L
[parent] => 1
)
[2] => Array
(
[id] => 4
[name] => M
[parent] => 1
)
)
)
[1] => Array
(
[id] => 5
[name] => Colors
[parent] => 0
[children] => Array
(
[0] => Array
(
[id] => 6
[name] => Blue
[parent] => 5
)
[1] => Array
(
[id] => 7
[name] => Yellow
[parent] => 5
)
)
)
)