方法一:
<?php $qq=12345678; echo '@@##@@';
方法二:
<?php
$qq=12345678;
$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);这两种方法的区别:
方法一的优点是可以输出头像的原图,如果你的头像是动态的gif,那么输出的也是动态图。缺点是速度比较慢,不适合作为调用头像的方法。
立即学习“PHP免费学习笔记(深入)”;
方法二的优点是相比第一种速度比较快,但只抓取头像的静态图,不会显示动态头像,比较适合作为调用头像的方法。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号