日期:2014-05-17 浏览次数:20501 次
$s =<<< TXT用户1
[ {
"Id" : "t1sd",
"Name" : "xiaoxiao",
"Namea" : "测试样子",
"nId" : "csd2"
}, {
"Id" : "ae2",
"Name" : "张三",
"Namea" : "哈哈",
"nId" : "20af"
}, {
"Id" : "c3P",
"Name" : "用户1",
"Namea" : "dingding",
"nId" : "4fc"
} ]
TXT;
$nId = '4fc';
$t = json_decode($s, true);
$r = array_filter($t, function($a)use($nId) { return $a['nId'] == $nId; });
echo current($r)['Name'];