无为清净楼资源网 Design By www.qnjia.com

实例如下所示:

 <!DOCTYPE html>
<html>
<body>
<"report":{"date":"2012-04-10","content":"abcdefght"}}';
 $arr = (array) json_decode($json,true);
 echo '当前日期是:'. $arr['report']['date'];
echo "<br/>";
echo '<pre>';
 print_r($arr);
echo '</pre>'; 
 
 foreach($arr as $arrvalue)
 {
 foreach($arrvalue as $key=>$value)
 {
  echo "[$key] = $value <br />";
 }
 }
echo "<br/>";
"text-align: center">php中输出json对象的值(实现方法)

<!DOCTYPE html>
<html>
<body>
<"json.txt");
if( $file_exists ){
 $myfile = fopen("json.txt", "r") or die("");
 $content = fread($myfile,filesize("json.txt"));
 fclose($myfile);
 echo $content;
 echo "<br/>";
 $arr=(array)json_decode($content,true);
 echo $arr['CSS'];
 echo "<br/>";
 echo $arr['AJAX'];
}
"text-align: center">php中输出json对象的值(实现方法)

json.txt:

{
 "AJAX": "Asynchronous JavaScript and XML",
 "CSS": "Cascading Style Sheets"
}

以上这篇php中输出json对象的值(实现方法)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

标签:
php,输出json对象

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com