Home > Article > PHP Framework > How to implement qq login in thinkphp
thinkphp method to implement qq login: 1. Perform developer authentication; 2. Create the qq method of the login controller; 3. Introduce the package in the Login controller; 4. In "application/config.php "Just add some configuration at the end.
The operating environment of this article: Windows 7 system, thinkphp v5.1 version, Dell G3 computer.
How does thinkphp implement qq login?
thinkphp5 implements QQ third-party login:
Developer certification: https://connect.qq.com/ (You need to click on your avatar to do so Enter the certification entrance, most of QQ Internet’s products have shit in their heads)
After passing the review, it will probably look like this:
After passing the review, you can create your own application :
Note: The title and website name must be consistent, otherwise the new application will not pass the review , although it will be assigned to the appid and appkey after it is created [still under review], but the appid and appkey assigned will not be used if it is under review or fails the review, which leads to the situation where the official SDK is used. , the data in the callback, the appid cannot be used, and a 100008 error is reported [appid does not exist]
Clicking the QQ icon here will request the qq of my login controller Method:
#The official SDK provided for us will be used here.
We introduce the package in the Login controller:
Next, we modify the third-party package and add a namespace to it, so that we have The introduction will be correct, and the method call will be correct [Third-party package download provided at the end]
We will put the third-party package in the extend file directory.
After introducing the package, we add some configurations at the end of application/config.php, because the imported package will read the configuration information of our file.
##Package file: Link: https://pan.baidu.com/s/1C3j98881Q515WQBeXQ50RgRecommended learning: "Extraction code: dzrz
The latest 10 thinkphp video tutorials"
The above is the detailed content of How to implement qq login in thinkphp. For more information, please follow other related articles on the PHP Chinese website!