当前位置:Gxlcms > PHP教程 > 求个php数组验证问题,在线等

求个php数组验证问题,在线等

时间:2021-07-01 10:21:17 帮助过:15人阅读

现在有这么一个数组,是属性表
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
    )

)

已解决`

人气教程排行