1、下載QQ SDKjavascript
下載地址:http://wiki.open.qq.com/wiki/mobile/SDKphp
2、配置SDKhtml
3、具體代碼java
login.htmlui
<!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.phpspa
<?php require_once("../API/qqConnectAPI.php"); $qc = new QC(); $qc->qq_login();
callback.phpcode
<?php require_once("../../API/qqConnectAPI.php"); $qc = new QC(); $access_token = $qc->qq_callback(); $openid = $qc->get_openid(); //處理你的邏輯。。。
效果圖以下:htm