Home >Backend Development >PHP Tutorial >How to get QQ avatar in php and display it, get qq avatar in php_PHP tutorial
The example in this article describes the method of obtaining QQ avatar and displaying it in php. Share it with everyone for your reference. The specific analysis is as follows:
Recently, I saw that the avatars in blog comments are a bit awkward, because the avatars of visitors all have the same avatar, which is not very comfortable to look at. Although most themes now integrate the Gavatar avatar function, let’s not talk about the issue of gavatar being blocked. I haven’t even gotten a gavatar avatar myself yet.
Because I logged in several times and the connection speed was extremely slow, I gave up. Of course, there are countless message plug-ins. For example, the popular Duodao is now, but for friends who have not registered Duodao, the avatar is still a problem. , I have tested Duosuo’s social account binding many times, QQ, Renren and other mainstream platforms often make mistakes, and some friends hate cumbersome authorization.
In view of this, I am thinking of a popular and relatively simple method. What I am thinking of is to call the QQ avatar of friends who do not have avatars. Because QQ now has at least one for everyone, so you only need to fill in the QQ number when leaving a message, and then Call its avatar, which will be much more convenient.
The first thing is to get the QQ avatar. This is also the first step of this idea, which is today’s topic.
The first method, the code is as follows:
The advantage of the first method is that it can output the original image of the avatar. If your avatar is a dynamic gif, then the output is also a dynamic image. The disadvantage is that it is relatively slow and is not suitable as a method to call the avatar.
The advantage of the second method is that it is faster than the first method, but it only captures the static image of the avatar and does not display the dynamic avatar. It is more suitable as a method of calling the avatar.
I hope this article will be helpful to everyone’s PHP programming design.