Home  >  Article  >  php教程  >  php正则取值放入数组求解

php正则取值放入数组求解

WBOY
WBOYOriginal
2016-06-06 19:42:321128browse

这是json 吗? 用json_decode(); $json_arr= json_decode(你的内容赋值给一个变量,true); $data = array(); foreach($json_arr['listInfo'] as $key=$val) { $data[$key]['nickname'] = $val["nickname"]; $data[$key]['apply_id'] = $val["apply_id"]; } v

这是json 吗? 用json_decode();

$json_arr = json_decode(你的内容赋值给一个变量,true);

 $data = array();
 foreach($json_arr['listInfo'] as $key=>$val)
{
           $data[$key]['nickname'] = $val["nickname"];
           $data[$key]['apply_id'] = $val["apply_id"];
}
        var_dump($data);

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