0

嗨有一个问题要解决,我正在尝试解决它很长时间..

这里是:

我得到了这个数组:

$arr = Array(
[0] => Array
    (
        [product_option_id] => 234
        [product_option_value] => Array
            (
                [0] => Array
                    (
                        [product_option_value_id] => 30
                        [option_value_id] => 65
                        [option_name] => 1.2 mm
                    )

                [1] => Array
                    (
                        [product_option_value_id] => 23
                        [option_value_id] => 50
                        [option_name] => 1.6 mm
                    )

            )

        [option_id] => 14
        [name] => Thickness (mm)
        [option_level] => 1
    )

[1] => Array
    (
        [product_option_id] => 232
        [product_option_value] => Array
            (
                [0] => Array
                    (
                        [product_option_value_id] => 19
                        [option_value_id] => 64
                        [option_name] => 22
                    )

                [1] => Array
                    (
                        [product_option_value_id] => 24
                        [option_value_id] => 54
                        [option_name] => 12
                    )

                [2] => Array
                    (
                        [product_option_value_id] => 25
                        [option_value_id] => 55
                        [option_name] => 14
                    )

                [3] => Array
                    (
                        [product_option_value_id] => 26
                        [option_value_id] => 57
                        [option_name] => 16
                    )

                [4] => Array
                    (
                        [product_option_value_id] => 27
                        [option_value_id] => 61
                        [option_name] => 19
                    )

                [5] => Array
                    (
                        [product_option_value_id] => 29
                        [option_value_id] => 49
                        [option_name] => 10
                    )

            )

        [option_id] => 13
        [name] => Length (mm)
        [option_level] => 2
    )

[2] => Array
    (
        [product_option_id] => 233
        [product_option_value] => Array
            (
                [0] => Array
                    (
                        [product_option_value_id] => 20
                        [option_value_id] => 51
                        [option_name] => Black
                    )

                [1] => Array
                    (
                        [product_option_value_id] => 22
                        [option_value_id] => 52
                        [option_name] => White
                    )

            )

        [option_id] => 15
        [name] => Color
        [option_level] => 3
    )

);

我想做类似的事情:1级的所有选项必须具有2级的所有选项,2级的所有选项必须具有3级的所有选项,依此类推......

[level1 Option A]
             [level2 Option B1]
                               [level 3 Option C1]
             [level2 Option B2]
                               [level 3 Option C1]
[level1 Option B]
             [level2 Option B1]
                               [level 3 Option C1]
             [level2 Option B2]
                               [level 3 Option C1]

有人能帮助我吗?我坚持下去。

提前致谢

4

0 回答 0