PHPCMSV9,微信登录插件,支持扫码

1、授权登陆因为微信只开放给服务号,所以必须是微信认证服务号才可以使用;

2、微信扫码登陆需要开发者认证,添加站点应用后才可以使用

3、没做过二次开发可直接覆盖,要把ID、KEY修改成自己的。

phpcms\languages\zh-cn\admin.lang.php
增加两个语言包
$LANG[‘setting_connect_wechat’] = ‘微信’;
$LANG[‘setting_connect_wechatcallback’] = ‘回调地址’;

phpcms\modules\admin\templates\setting.tpl.php
增加微信ID、key和回调地址

</tr>
    <th><?php echo L('setting_connect_wechat')?></th>
    <td class="y-bg">
	App I D  &nbsp;<input type="text" class="input-text" name="setconfig[wechat_appid]" id="wechat_appid" size="20" value="<?php echo $wechat_appid ?>"/>
	App key <input type="text" class="input-text" name="setconfig[wechat_appkey]" id="wechat_appkey" size="40" value="<?php echo $wechat_appkey ?>"/>
    <?php echo L('setting_connect_wechatcallback')?> <input type="text" class="input-text" name="setconfig[wechat_callback]" id="wechat_callback" size="40" value="<?php echo $wechat_callback;?>"/>
     <a href="http://mp.weixin.qq.com/" target="_blank"><?php echo L('click_register')?></a>
	</td>
  </tr>

phpcms\modules\admin\functions\global.func.php
set_config方法增加wechat_appid wechat_appkey wechat_callback

caches\configs\system.php
增加
‘wechat_appkey’ => ‘ ‘, //微信 appkey
‘wechat_appid’ => ‘ ‘, //微信 appid
‘wechat_callback’ => ‘ ‘, //微信回调地址

phpcms\modules\member\index.php
增加wechat方法

phpcms\templates\default\member\login.html
增加微信登录扫码方法

phpcms\modules\member\classes\foreground.class.php
增加判断wechat

[content_hide]

[b2_file link=”https://pan.baidu.com/s/1u2EVW-jDx4sI5jjFmcnrYA” name=”微信登录” pass=”pt4g” ]

[/content_hide]

评论

  1. ╭年少 的头像
    ╭年少

    学习一下

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注