Home > Backend Development > PHP Tutorial > How to read json data code in php

How to read json data code in php

小云云
Release: 2023-03-20 15:14:02
Original
2584 people have browsed it

This article will share with you how to read json data code in PHP. The code is very short. I hope it can help everyone.

<?php
$json = "{&#39;a&#39;:&#39;1&#39;,&#39;b&#39;:&#39;2&#39;,&#39;c&#39;:&#39;abcdefg&#39;}";
vardump(json_decode($json));
vardump(json_decode($json,true));
Copy after login

Note: If the true parameter is not added, an object will be output, and if the true parameter is added, it will be output in the form of an array

Related recommendations:

NodeJs Precautions when reading JSON file format

php remote Analysis of the method of reading json

php performance issues in reading json files

The above is the detailed content of How to read json data code in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template