我从这样的网址获得了一个JSON:
http://myweb.com/ws_clc/ws_info.php?uid=77317
JSON:
{
"status":1,
"info":[
{
"uid":"77317",
"name":"Jack",
"lastname":"Black",
"email":"jackblack@mail.com"
}
]
}
我需要在HTML上格式化JSON。 我怎么能这样做?
感谢!!!我是这样做的:
<?php
$uid =$_GET['uid'];
$json = file_get_contents('http://myweb.com/ws_clc/ws_info.php?uid='.$uid);
$obj = json_decode($json);
$uid= $obj->info[0]->uid;
$name = $obj->info[0]->name;
$lastname = $obj->info[0]->lastname;
echo $name;
echo $lastname;
?>