看起来是这样的:
Array
(
[0] => Array
(
[id] => 53
[delivery_partner_id] => 6
[delivery_partner_product_id] => 37
[parent_id] => 0
[name] => group 1
[description] =>
[parent_option_type] => single
[price_type] => not_set
[price_sell] =>
[price_purchase] =>
[sort] => 1
[created_at] => 2018-08-12 21:35:14
[updated_at] => 2018-08-12 21:35:14
[values] => Array
(
[0] => Array
(
[id] => 54
[delivery_partner_id] => 6
[delivery_partner_product_id] => 37
[parent_id] => 53
[name] => option name
[description] =>
[parent_option_type] => not_set
[price_type] => free
[price_sell] => 0.00
[price_purchase] => 0.00
[sort] => 1
[created_at] => 2018-08-12 21:35:14
[updated_at] => 2018-08-12 21:35:14
)
[1] => Array
(
[id] => 55
[delivery_partner_id] => 6
[delivery_partner_product_id] => 37
[parent_id] => 53
[name] => option name
[description] =>
[parent_option_type] => not_set
[price_type] => free
[price_sell] => 0.00
[price_purchase] => 0.00
[sort] => 2
[created_at] => 2018-08-12 21:35:14
[updated_at] => 2018-08-12 21:35:14
)
[2] => Array
(
[id] => 56
[delivery_partner_id] => 6
[delivery_partner_product_id] => 37
[parent_id] => 53
[name] => option name
[description] =>
[parent_option_type] => not_set
[price_type] => free
[price_sell] => 0.00
[price_purchase] => 0.00
[sort] => 3
[created_at] => 2018-08-12 21:35:14
[updated_at] => 2018-08-12 21:35:14
)
)
)
[1] => Array
(
[id] => 57
[delivery_partner_id] => 6
[delivery_partner_product_id] => 37
[parent_id] => 0
[name] => group 1
[description] =>
[parent_option_type] => single
[price_type] => not_set
[price_sell] =>
[price_purchase] =>
[sort] => 2
[created_at] => 2018-08-12 21:35:14
[updated_at] => 2018-08-12 21:35:14
[values] => Array
(
[0] => Array
(
[id] => 58
[delivery_partner_id] => 6
[delivery_partner_product_id] => 37
[parent_id] => 57
[name] => option name
[description] =>
[parent_option_type] => not_set
[price_type] => free
[price_sell] => 0.00
[price_purchase] => 0.00
[sort] => 1
[created_at] => 2018-08-12 21:35:14
[updated_at] => 2018-08-12 21:35:14
)
[1] => Array
(
[id] => 59
[delivery_partner_id] => 6
[delivery_partner_product_id] => 37
[parent_id] => 57
[name] => option name
[description] =>
[parent_option_type] => not_set
[price_type] => free
[price_sell] => 0.00
[price_purchase] => 0.00
[sort] => 2
[created_at] => 2018-08-12 21:35:14
[updated_at] => 2018-08-12 21:35:14
)
[2] => Array
(
[id] => 60
[delivery_partner_id] => 6
[delivery_partner_product_id] => 37
[parent_id] => 57
[name] => option name
[description] =>
[parent_option_type] => not_set
[price_type] => free
[price_sell] => 0.00
[price_purchase] => 0.00
[sort] => 3
[created_at] => 2018-08-12 21:35:14
[updated_at] => 2018-08-12 21:35:14
)
)
)
)
1
问题是,可能会有同名的组,其值完全相同。但是,我怎样才能根据组值和“值”使这个唯一?
我尝试使用array unique,但问题是嵌套数组的值由于某种原因无法工作。我正在尝试另一种方法来做这件事。
它应该首先检查两个组是否存在相同的值,如果是真的,则应该检查值数组并检查两个值是否相同。如果一切都一样,它应该删除副本。