Home  >  Article  >  Backend Development  >  A piece of code that uses php to parse JSON data

A piece of code that uses php to parse JSON data

WBOY
WBOYOriginal
2016-07-25 09:03:121309browse
  1. $json_string='{"id":1,"name":"foo","email":"foo@foobar.com","interest":["wordpress","php"]} ';
  2. $obj=json_decode($json_string);
  3. echo $obj->name; //prints foo
  4. echo $obj->interest[1]; //prints php
  5. ?>
复制代码


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