This time I will show you how to output json objects in PHP. What are theprecautions for outputting JSON objects in PHP? The following is a practical case, let's take a look.
An example is as follows:
"; echo ''; print_r($arr); echo ''; foreach($arr as $arrvalue) { foreach($arrvalue as $key=>$value) { echo "[$key] = $value
"; } } echo "
"; ?>Copy after login
"; $arr=(array)json_decode($content,true); echo $arr['CSS']; echo "
"; echo $arr['AJAX']; } ?>
json.txt:
{ "AJAX": "Asynchronous JavaScript and XML", "CSS": "Cascading Style Sheets" }
How to operate format files in php
The above is the detailed content of How to output json object in php. For more information, please follow other related articles on the PHP Chinese website!