LXG
“QQ登录”是目前最为流行的网站社会化登陆方式,是腾讯公司提供给第三方网站的一种服务,可以让用户使用QQ帐号及信息在其它网站上登录,分享内容、同步信息,从而大大减少了用户注册的繁琐步骤,真正实现了一键登陆。借助QQ庞大的用户群,接入QQ登陆的第三方网站,可以轻松地提升网站的用户数。LXG
LXG
一、申请接入,获取appid和appkey,申请地址:http://open.qq.com/LXG
LXG
这里不再赘述,先申请应用,再审核。LXG
LXG
二、加入jsLXG
LXG
在任意网站页面中在<head></head>标签中加入QQ登录的JSSDK库:原代码如下:LXG
LXG
<scripttype="text/javascript"src="http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js"data-appid="申请来的APPID"data-redirecturi="回调页面URL,如:http://www.2ky.cn/qqlogin/transfer.htm"charset="utf-8"></script>LXG
LXG
三、加入QQ登录按钮LXG
LXG
在<body>标签中需要显示QQ登陆图标的地方,加入以下代码:LXG
LXG
LXG
<div style=" margin-top:200px;">LXG
<span id="qq_login_btn"></span> LXG
<script type="text/javascript"> LXG
QC.Login({//按默认样式插入QQ登录按钮 LXG
btnId:"qq_login_btn" //插入按钮的节点id LXG
}); LXG
</script> LXG
</div>LXG
LXG
LXG
LXG
完成,演示看http://www.wenzhaihui.com/qq.htmlLXG
LXG
LXG
完整代码可以直接复制使用:LXG
LXG
LXG<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">LXG
<htmlxmlns="http://www.w3.org/1999/xhtml">LXG
<head>LXG
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>LXG
<metaname="keywords"content="[!--pagekeywords--]"/>LXG
<metaname="description"content="[!--pagedescription--]"/>LXG
LXG
LXG
<metaproperty="qc:admins"content="12772662310165464510063757"/>LXG
<scripttype="text/javascript"src="http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js"LXG
data-appid="101154742"data-redirecturi="http://www.wenzhaihui.com/e/memberconnect/qq/loginend.php"charset="utf-8"></script>LXG
<title>[!--pagetitle--]</title>LXG
</head>LXG
LXG
<body>LXG
LXG
LXG
<div style=" margin-top:200px;">LXG
<span id="qq_login_btn"></span> LXG
<script type="text/javascript"> LXG
QC.Login({//按默认样式插入QQ登录按钮 LXG
btnId:"qq_login_btn" //插入按钮的节点id LXG
}); LXG
</script> LXG
</div>LXG
LXG
</body>LXG
</html>LXG
LXG
http://m.gsyjwlkj.com/meiwen/16986.html
推荐访问