实例如下所示:
<!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 条评论) |