转phpcms v9 微信登录 支持开放平台和微信公众平台
新建 wechat.php 仿到根目录
<?phpif(!empty( $_GET['code']) && !empty( $_GET['state'])){$code = $_GET['code'];$state = $_GET['state'];$url = "http://www.rang9.com/index.php?m=member&c=index&a=wechat&code=$code&state=$state";header('location:'.$url);exit;}$loginurl ="http://www.rang9.com/wechat.php";$appid = 'appid';//$url = "https://open.weixin.qq.com/connect/qrconnect?appid=$appid&redirect_uri=http://www.rang9.com/wechat.php&response_type=code&scope=snsapi_login&state=1&connect_redirect=1#wechat_redirect";//开放平台$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=$appid&redirect_uri=$loginurl&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";//公众平台header('location:'.$url);?>
phpcms\modules\member index.php中添加如下代码
public function wechat() {}
参考附件 : index.rar (15.31 KB)
记得把AppID AppSecret 换成你自己的
缺点是暂时还没有处理好头像问题,高手请处理一下
官网地址:http://bbs.phpcms.cn/thread-936947-1-1.html