本地json文件 data.json
- {
- "name": "Tom",
- "age": "25"
- }
-
PHP读取本地json,并转换成PHP数组
- <?php
-
- $data = json_decode(file_get_contents('./data.json'), true);
- print_r($data);
-
- // Array
- // (
- // [name] => Tom
- // [age] => 25
- // )
-
PHP:读取本地json文件并转换成PHP数组
本地json文件 data.json
- {
- "name": "Tom",
- "age": "25"
- }
-
PHP读取本地json,并转换成PHP数组
- <?php
-
- $data = json_decode(file_get_contents('./data.json'), true);
- print_r($data);
-
- // Array
- // (
- // [name] => Tom
- // [age] => 25
- // )
-