How to integrate qq Internet login in php

藏色散人
Release: 2023-04-09 14:58:02
forward
2599 people have browsed it

How to integrate qq Internet login in php

Related recommendations: "PHP Training"

php integrated qq internet login

access After QQ Internet platform, we can allow users to log in to our website through QQ account login, which reduces the tedious registration and can bring more users to me faster and more conveniently. Let’s take a look at how Third-party login is achieved through QQ Internet.

Apply for qualifications

First go to the QQ Internet official website: https://connect.qq.com/index.html to apply to become a developer, and then add your own information You can create an application. Get the APP ID and APP Key

Download SDK

Here we go to http://wiki.connect.qq.com/sdk to download the sdk corresponding to the website.

How to integrate qq Internet login in php

Install and configure the SDK

Put the SDK we downloaded into the php running environment to access the SDK, a prompt will appear Configure SDK, and view official documentation options.

How to integrate qq Internet login in php

Code implementation

Copy the oauth folder in the example folder in the SDK to the same level directory as the API folder , modify the path to load qqContentApi.php in callback.php and index.php in the oauth folder.

How to integrate qq Internet login in php

The front page displays the QQ login prompt:

QQ登录 
Copy after login

Clicking [QQ Login] will open the QQ authorized login interface

Callback processing

After successful login with clickback, the callback interface will be triggered. Here we can do some operations on the data, such as inserting it into our own database, or requesting to bind an account, etc. .

require_once("/API/qqConnectAPI.php"); $qc = new QC(); $qc->qq_callback(); //返回的验证值 $openid = $qc->get_openid(); //qq分配的用户id $result = $qc->get_user_info(); //获取用户登录信息
Copy after login

The above is the detailed content of How to integrate qq Internet login in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jianshu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!