php 数组解决办法
程序员文章站
2024-01-12 18:18:58
...
php 数组
Array
(
[0] => Array
(
[category_id] => 15
[category_name] => 14inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[1] => Array
(
[category_id] => 16
[category_name] => 15inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[2] => Array
(
[category_id] => 17
[category_name] => 16inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[3] => Array
(
[category_id] => 18
[category_name] => 17inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[4] => Array
(
[category_id] => 36
[category_name] => SUV
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
[5] => Array
(
[category_id] => 37
[category_name] => VAN
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
[6] => Array
(
[category_id] => 42
[category_name] => 16inch
[parent_category_id] => 87
[parent_name] => 国産タイヤ 単品
)
[7] => Array
(
[category_id] => 43
[category_name] => 17inch
[parent_category_id] => 87
[parent_name] => 国産タイヤ 単品
)
[8] => Array
(
[category_id] => 82
[category_name] => 24inch
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
)
按照 parent_category_id 他的值进行分组。
比如:
Array
(
[0] => Array
( [0] => Array
(
[category_id] => 15
[category_name] => 14inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[1] => Array
(
[category_id] => 16
[category_name] => 15inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[2] => Array
(
[category_id] => 17
[category_name] => 16inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[3] => Array
(
[category_id] => 18
[category_name] => 17inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
)
[1] => Array
(
[0] => Array
(
[category_id] => 36
[category_name] => SUV
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
[1] => Array
(
[category_id] => 37
[category_name] => VAN
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
[2] => Array
(
[category_id] => 82
[category_name] => 24inch
Array
(
[0] => Array
(
[category_id] => 15
[category_name] => 14inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[1] => Array
(
[category_id] => 16
[category_name] => 15inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[2] => Array
(
[category_id] => 17
[category_name] => 16inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[3] => Array
(
[category_id] => 18
[category_name] => 17inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[4] => Array
(
[category_id] => 36
[category_name] => SUV
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
[5] => Array
(
[category_id] => 37
[category_name] => VAN
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
[6] => Array
(
[category_id] => 42
[category_name] => 16inch
[parent_category_id] => 87
[parent_name] => 国産タイヤ 単品
)
[7] => Array
(
[category_id] => 43
[category_name] => 17inch
[parent_category_id] => 87
[parent_name] => 国産タイヤ 単品
)
[8] => Array
(
[category_id] => 82
[category_name] => 24inch
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
)
按照 parent_category_id 他的值进行分组。
比如:
Array
(
[0] => Array
( [0] => Array
(
[category_id] => 15
[category_name] => 14inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[1] => Array
(
[category_id] => 16
[category_name] => 15inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[2] => Array
(
[category_id] => 17
[category_name] => 16inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
[3] => Array
(
[category_id] => 18
[category_name] => 17inch
[parent_category_id] => 1
[parent_name] => ホイール?タイヤセット
)
)
[1] => Array
(
[0] => Array
(
[category_id] => 36
[category_name] => SUV
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
[1] => Array
(
[category_id] => 37
[category_name] => VAN
[parent_category_id] => 2
[parent_name] => 輸入タイヤ 単品
)
[2] => Array
(
[category_id] => 82
[category_name] => 24inch
相关文章
相关视频
上一篇: Vim命令高级用法