本文主要和大家分享php如何输出json对象的值,希望能帮助到大家。
实例如下所示:
<!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 class="brush:php;toolbar:false">'; print_r($arr); echo ''; foreach($arr as $arrvalue) { foreach($arrvalue as $key=>$value) { echo "[$key] = $value