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.
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.
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.
The front page displays the QQ login prompt:
QQ登录
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(); //获取用户登录信息
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!