Home>Article>Backend Development> How to convert php string to json

How to convert php string to json

hzc
hzc Original
2020-06-10 15:02:55 7889browse

How to convert php string to json

The method to convert php string into json is:

1. First, open the php editor and create a new php file, for example: index .php, which defines a json string.

2. In index.php, enter the code: print_r(json_decode($a));.

3. The browser runs the index.php page, and the json object converted from this string will be printed out.

Recommended tutorial: "php tutorial"

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

Statement:
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