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; }
function getQqUinfo($info) { $token = $info['token']; $key = $info['client_id']; $openid = $info['openid']; $userinfoUrl = "https://graph.qq.com/user/get_user_info?access_token={$token}&oauth_consumer_key={$key}&openid={$openid}"; $userinfo = file_get_contents($userinfoUrl); $user_info = std_class_object_to_array(json_decode($userinfo)); $user_info['openid'] = $openid; return $user_info; }