求个php数组验证问题,在线等
程序员文章站
2022-06-09 20:02:48
...
现在有这么一个数组,是属性表
Array
(
Array
(
[0] => Array
(
[list_attr_id] => 30
[list_attr_name] => 颜色
[list_attr_attr] => 黑色|白色|金色
[list_attr_price] => 0|10.1|20
[list_attr_shop_id] => 28
)
[1] => Array
(
[list_attr_id] => 31
[list_attr_name] => 规格
[list_attr_attr] => 16GB|64GB|128GB
[list_attr_price] => 0|30|40.22
[list_attr_shop_id] => 28
)
[2] => Array
(
[list_attr_id] => 32
[list_attr_name] => 型号
[list_attr_attr] => 2G|3G|4G
[list_attr_price] => 1|2|3
[list_attr_shop_id] => 28
)
)
用户选中了一下属性,每个属性对应当前数组的值,请问我怎么验证他的值和数据库一模一样,谢谢
$data =Array
(
[shop_id] => 28
[attr_ids] => Array
(
[0] => 30
[1] => 31
[2] => 32
)
[attr_prices] => Array
(
[0] => 10.1
[1] => 0
[2] => 1
)
[attr_names] => Array
(
[0] => 白色
[1] => 16GB
[2] => 2G
)
)
回复内容:
现在有这么一个数组,是属性表
Array
(
[0] => Array
(
[list_attr_id] => 30
[list_attr_name] => 颜色
[list_attr_attr] => 黑色|白色|金色
[list_attr_price] => 0|10.1|20
[list_attr_shop_id] => 28
)
[1] => Array
(
[list_attr_id] => 31
[list_attr_name] => 规格
[list_attr_attr] => 16GB|64GB|128GB
[list_attr_price] => 0|30|40.22
[list_attr_shop_id] => 28
)
[2] => Array
(
[list_attr_id] => 32
[list_attr_name] => 型号
[list_attr_attr] => 2G|3G|4G
[list_attr_price] => 1|2|3
[list_attr_shop_id] => 28
)
)
用户选中了一下属性,每个属性对应当前数组的值,请问我怎么验证他的值和数据库一模一样,谢谢
$data =Array
(
[shop_id] => 28
[attr_ids] => Array
(
[0] => 30
[1] => 31
[2] => 32
)
[attr_prices] => Array
(
[0] => 10.1
[1] => 0
[2] => 1
)
[attr_names] => Array
(
[0] => 白色
[1] => 16GB
[2] => 2G
)
)
已解决`