第一种:看下面的具体的源码:
<?php
$qq=2424348224;//这里设置要获取头像的QQ号码
echo '<img src="'.'http://q1.qlogo.cn/g?b=qq&nk='.$qq.'&s=100&t='.time().'">';
?>
上面的这种方法非常简单,并且如果QQ头像是gif动画,也能输出动画,缺点就是速度慢,再来看下面的另一种方法:
<?php
$qq=2424348224;//要获取头像的QQ号码
$src='http://q1.qlogo.cn/g?b=qq&nk='.$qq.'&s=100&t='.time();
header('Content-type: image/png');
$res=imagecreatefromstring(file_get_contents($src));
imagepng($res);
imagedestroy($res);
?>
最近学习destoon内核而做的一个行业平台,圆柱模板 - http://zhimo.yuanzhumuban.cc/
转载于:https://blog.51cto.com/11024720/2071465