将json 转成数组

//json转换
function std_class_object_to_array($stdclassobject)
{

    $_array = is_object($stdclassobject) ? get_object_vars($stdclassobject) : $stdclassobject;

    foreach ($_array as $key => $value)
    {
        $value = (is_array($value) || is_object($value)) ? std_class_object_to_array($value) : $value;
        $array[$key] = $value;
    }

    return $array;
}

std_class_object_to_array(json_decode($obj));//$obj 是json数据

json 数据

[{"name":"长白山国际天然滑雪公园平日468元/全天/人","mon":"468","smon":"400","zhekou":"8.5"}]

array('name'=>'长白山国际天然滑雪公园平日468元/全天/人','mon'=>'468','smon'=>'400','zhekou'=>'8.5')

 

你可能感兴趣的:(json,数组)