$s =<<< JSON
[
{"title": "11111111","channel": {"country": "USA"}},
{"title": "222222222","channel": {"country": "UK"}},
{"title": "3333333","channel": {"country": "China"}}
]
JSON;
$json = json_decode($s);
$r = array_filter($json, function($json) { return $json->channel->country == "UK"; });
print_r($r);Array
(
    [1] => stdClass Object
        (
            [title] => 222222222
            [channel] => stdClass Object
                (
                    [country] => UK
                )        ))

解决方案 »

  1.   


    $s =<<< JSON
    [
    {"title": "11111111","channel": {"country": "USA"}},
    {"title": "222222222","channel": {"country": "UK"}},
    {"title": "3333333","channel": {"country": "China"}}
    ]
    JSON;
    $json = json_decode($s,true);
    foreach($json as $v){
        if ($v['channel']['country'] == 'UK'){$arr[] = $v;}
    }
    echo '<pre>';print_r($arr);
    Array
    (
        [0] => Array
            (
                [title] => 222222222
                [channel] => Array
                    (
                        [country] => UK
                    )        ))