首页 > 作文

php中输出json对象的值(实现方法)

更新时间:2023-04-06 17:59:28 阅读: 评论:0

实例如下所示:

 <!doctype html><html><body><?php $json = '{"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>';   fore1366x768壁纸ach($arr as $arrvalue) { foreach($arrvalue as $key=>$value) {  echo "[$key] = $value <br />"; } }echo "<br/>"万耀平;?> </body></html>

<!doctype h人口因素tml><html><body><?php$file_exists = file_exists("json.txt")寻找最美孝心少年2014;if( $file_exists ){ $myfile = fopen("json.txt", "r") or die(""); $content = fread($myfile,filesize("json.txt")); fclo($myfile); echo $content; echo "<br/>"; $arr=(array)json_decode($content,true); echo $arr['css']; echo "<br/>"; echo $arr['ajax'];}?> </body></html>

json.txt:

{ "ajax": "asynchronous javascript and xml", "css": "c龙猫多少钱一只ascading style sheets"}

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

本文发布于:2023-04-06 17:59:26,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/a41a6da3e7bde077d644544b5e73f6e4.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:php中输出json对象的值(实现方法).doc

本文 PDF 下载地址:php中输出json对象的值(实现方法).pdf

标签:给大家   一只   希望能   孝心
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图