php历遍json对象

//直接上例子:
$string={"文字1":{"link":"链接","son":{"文字11":"链接","文字12":"链接"}},"文字2":{"link":"链接"}};
$json=json_decode($string,true);
foreach($json as $key=>$arr)
{
    echo "[$key]=".$arr['son']." *****<br />";//前者是key后者是值(值可能还是数组)
    foreach($arr as $keyChild=>$arrChild)
    {
      echo “[$keyChild]=$arrChild —–<br />”;
    }
}