直取(当前qq所用的)图标:
方案1:http://q1.qlogo.cn/g?b=qq&nk=10001&s=100
方案2:http://q2.qlogo.cn/headimg_dl?dst_uin=10001&spec=100
其中10001为QQ号码
方案3:以下为php片段代码,通过QQ空间获取昵称和图标
$api = 'http://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg'; $qqArr = [ '10001', ]; $ret = file_get_contents($api . '?' . http_build_query(['uins' => implode(',', $qqArr)])); $ret = mb_convert_encoding((string)$ret,'UTF-8'); $ret = str_replace("\n", '', $ret); preg_match('/^.*\((.*)\)\;{0,1}$/', $ret, $match); $infoStr = $match[1]; $infoArr = json_decode($infoStr, true); if(isset($infoArr['error'])){ $errInfo = $infoArr['error']; echo isset($errInfo['msg']) ? $errInfo['msg'] : json_encode($errInfo); exit(); } $userInfo = []; foreach ($infoArr as $userId => $info) { $userInfo[] = [ 'user_id' => $userId, 'qq' => array_shift($qqArr), 'head_img' => isset($info[0]) ? $info[0] : '', 'nickname' => isset($info[6]) ? $info[6] : '', ]; } print_r($userInfo); echo ' '; print_r($infoArr); exit();