PHP 之QQ第三方登录
一、下载QQ SDK
下载地址:http://wiki.open.qq.com/wiki/mobile/SDK
二、配置SDK
三、具体代码
login.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <img src="./qq_login.png" alt="" onclick='toQzoneLogin()'> <script type="text/javascript"> var childWindow; function toQzoneLogin() { childWindow = window.open("./index.php","TencentLogin","width=450,height=320,menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1"); } function closeChildWindow() { childWindow.close(); } </script> </body> </html>
index.php
<?php require_once("../API/qqConnectAPI.php"); $qc = new QC(); $qc->qq_login();
callback.php
<?php require_once("../../API/qqConnectAPI.php"); $qc = new QC(); $access_token = $qc->qq_callback(); $openid = $qc->get_openid(); //处理你的逻辑。。。
效果图如下: