In our daily development work, we may encounter php recursive json. So today we will introduce to you the code of the php recursive json class, parse the main function, parse the index array, parse the numeric array, and check whether an array is Strictly numerical index.
First download the php recursive json class library we need to use in this course: http://www.php.cn/xiazai/leiku/561
Find us after the download is complete Unzip the required php class files to our local directory and create a new php file!
After completion, we need to call this class in the new php file and instantiate the class:
<?php include_once "json.php";//引入类文件 $arr1 = array("网站"=>"php中文网","网址"=>"www.php.cn");//定义数组 $obj = new json($arr1); //实例化 echo "解析主函数:".$obj->MainArr()."<br>";//解析主函数 echo "解析索引数组:".$obj->IndexArr($arr1)."<br>";//解析索引数组 $arr2 = array("123"=>"php中文网","124"=>"www.php.cn");//定于数字索引数组 echo "解析数字数组:".$obj->NumArr($arr2)."<br>";//解析数字数组 ?>
Run the file and the result will be as shown below:
The above is the detailed content of Introduction to development examples of php recursive json. For more information, please follow other related articles on the PHP Chinese website!