php如何读取json文件里面的内容并转为数组
php如何读取json文件里面的内容并转为数组,下面编程教程网小编给大家详细介绍一下实现代码!
file_get_contents()函数语法介绍
file_get_contents($filename,$include_path,$context,$offset,$max_length)
具体代码介绍
<?php
header('content-type:text/html;charset=utf-8');
$json_string=file_get_contents('aaa.json');
echo $json_string;
$arr=json_decode($json_string,true); //将json字符串转成php数组
var_dump($arr);
?>
需要新建一个aaa.json文件~
以上是编程学习网小编为您介绍的“php如何读取json文件里面的内容并转为数组”的全面内容,想了解更多关于 php入门 内容,请继续关注编程基础学习网。