1 <?php 2 3 $json = ‘{"a":1,"b":2,"c":3,"d":4,"e":5}‘; 4 5 //json_decode 将json格式的字符串转成php数组或者对象 6 $object = json_decode($json); //转成php对象(stdClass Object) 7 echo $object->a.‘**‘; 8 echo $object->b.‘**‘; 9 echo $object->c.‘**‘; 10 echo $object->d.‘**‘; 11 echo $object->e; 12 13 $arr = json_decode($json,true); //转成php数组 14 echo "<pre/ >"; 15 print_r($arr); 16 ?>
时间: 2024-10-13 02:24:31