首頁 >後端開發 >php教程 >求个php数组验证问题,在线等

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

WBOY
WBOY原創
2016-06-06 20:17:581112瀏覽

现在有这么一个数组,是属性表
Array
(

<code>[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
    )
</code>

)

用户选中了一下属性,每个属性对应当前数组的值,请问我怎么验证他的值和数据库一模一样,谢谢
$data =Array
(

<code>[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
    )
</code>

)

回复内容:

现在有这么一个数组,是属性表
Array
(

<code>[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
    )
</code>

)

用户选中了一下属性,每个属性对应当前数组的值,请问我怎么验证他的值和数据库一模一样,谢谢
$data =Array
(

<code>[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
    )
</code>

)

已解决`

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn