1
kevin8096 2015-04-09 19:49:23 +08:00
$obj = json_decode($jsonData) ;
$obj->data ?? |
2
kevin8096 2015-04-09 19:53:45 +08:00
看错了。抱歉
|
3
feiyuanqiu 2015-04-09 21:15:29 +08:00 1
需要先转成数组或对象处理之后再转回来吧?直接出结果的函数好像没有
$from = '{"status": "success","total": 1,"data": [{"id": 1,"type": 0,"logo": "1428470471LLnfH.jpg","name": "123","profile": "","city": "","address": "","location": "","email": "[email protected]","phone": "123456","website": "","weibo": "","service": "","tags": "","user_count": 3,"thumb_logo": "http://120.25.210.83/upload/companies/thumb/1428470471LLnfH.jpg"}]}'; $from = json_decode($from, true); array_walk($from['data'], function (&$item) { $picks = array( 'id' => '', 'logo' => '', 'name' => '', 'email' => '', 'phone' => '', 'tags' => '', 'user_count' => '', 'thumb_logo' => '', ); $item = array_intersect_key($item, $picks); }); $from = json_encode($from); |