Home  >  Article  >  Backend Development  >  求个php数组验证问题,在线等

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

WBOY
WBOYOriginal
2016-06-06 20:17:581070browse

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

)

已解决`

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn