1、首先到微信开放平台申请https://open.weixin.qq.com/ 获取到appid和APPSECRET,前台显示页面如下html>
var obj = new WxLogin({
id: "login_container",
appid: "wxed782be999f86e0e",
scope: "snsapi_login",
redirect_uri: encodeURIComponent("http://" + window.location.host + "/login.php"),
state: Math.ceil(Math.random()*1000),
style: "black",
href: ""});
2、PHP处理代码页面/*
require_once('weixin.class.php');
$weixin = new class_weixin();
*/
define('APPID', "wx19ba77624e083e08");
define('APPSECRET', "c1a56a5c4247dd44c320c9719c5ceb90");
class class_weixin
{
var $appid = APPID;
var $appsecret = APPSECRET;
//构造函数,获取Access Token
public function __construct($app