(1)php解析json,(2)数组转成json


<?php 

$json ='[
  {
    "title":"homepage"
    ,"url":"http://www.1500km.com"
  }
  ,{
    "title":"blog"
    ,"url":"http://blog.1500km.com"
  }
  ,{
    "qq":"3166692976"
    ,"more":"有事请留言,直接描述问题,我看到后尽快处理。"
  }
]';


echo '=====json转为数组=====';
$array = json_decode($json,TRUE);
print_r($array);


echo '=====数组转为json=====';
$temp = json_encode($array);
echo $temp;

?>

程序运行结果如下: