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
// )

猜你喜欢

转载自blog.csdn.net/mouday/article/details/124899059
今日推荐