Home >Backend Development >PHP Tutorial >How to output the value of json object in php
This article mainly shares with you how to output the value of json object in PHP. I hope it can help you.
The example is as follows:
<!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