PHP stdClass Object转array

public static function object_array($array) {
        if(is_object($array)) {
            $array = (array)$array;
        } if(is_array($array)) {
            foreach($array as $key=>$value) {
                $array[$key] = self::object_array($value);
            }
        }
        return $array;
    }

 

posted @ 2021-07-02 18:03  _迷途  阅读(36)  评论(0编辑  收藏  举报