ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` ~~~ /** * @param $qq * @return array * @date: 2020/3/26 * @name: getQQ * @describe: 获取QQ信息 */ public static function getQQ($qq){ $returnArr = ['code' => 0, 'msg' => '获取失败']; if (!$qq || !preg_match('|^[1-9]\d{4,10}$|i', $qq)) { $returnArr['msg'] = 'QQ格式错误'; return $returnArr; } $nickname = file_get_contents('https://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?g_tk=1518561325&uins=' . $qq); $image = 'http://q.qlogo.cn/headimg_dl?dst_uin=' . $qq . '&spec=100'; if (strstr($nickname, 'portraitCallBack')) { $name = trim(mb_convert_encoding($nickname, "UTF-8", "GBK"), 'portraitCallBack()'); $name = json_decode($name, true); if (isset($name[$qq][6]) && !empty($name[$qq][6])) { $name = $name[$qq][6]; } else { $name = '游客'; } $returnArr = array('code' => 1, 'msg' => '成功', 'image' => $image, 'name' => $name, 'qq' => $qq); } else if (strstr($nickname, '_Callback')) { $returnArr['msg'] = '获取昵称失败'; } return $returnArr; } ~~~ ```