最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
PHP解析JSON与XML程序
时间:2022-06-24 20:51:49 编辑:袖梨 来源:一聚教程网
与大多数流行的 Web 服务如 twitter 通过开放 API 来提供数据一样,它总是能够知道如何解析 API 数据的各种传送格式,包括 JSON,XML 等等。
$json_string='{"id":1,"name":"foo","email":"[email protected]","interest":["wordpress","php教程"]} ';
$obj=json_decode($json_string);
echo $obj->name; //prints foo
echo $obj->interest[1]; //prints php
PHP解析XML 数据
$xml_string="
//load the xml string using simplexml
$xml = simplexml_load_string($xml_string);
//loop through the each node of user
foreach ($xml->user as $user)
{
//access attribute
echo $user['id'], ' ';
//subnodes are accessed by -> operator
echo $user->name, ' ';
echo $user->email, '
';
}
相关文章
- 画涯无删减版安卓手机下载-画涯官方网站入口链接地址 02-06
- 樱桃漫画怎么找不到了?最新地址及漫画搜索教程分享 02-06
- uc浏览器网页版一键直达-uc浏览器网页版官方入口 02-06
- 蛋仔派对官服下载安装包最新版本-蛋仔派对官服下载入口一键安装 02-06
- 虫虫漫画官网-虫虫漫画官网入口地址 02-06
- 画涯网页版在线观看地址-2026画涯漫画最新版本网页版入口链接 02-06