波波后续参与技术类开发工作将越来越少,有空的时候波波会将自己14年来开发的技术类笔记整理后分阶段分享,后续也会为大家分享一些视频教程。主要面向对象依然是新手。
关于微擎的开发,初次看代码难免迷茫,没关系,相信波波整理的系列教程可以帮大家快速入门。当然前提是你需要具备基础的PHP开发能力。
微擎全局变量:
- global $_W,$_GPC;
- $_W['siteroot'] http://bxy.x.com/
- $_W['account']['name'] 公众号名称
- $_W['isajax'] 是否ajax
- $_W['ispost'] 是否POST
- $_W['uniacid'] 公众号id
- $_W['siteurl'] 当前页面地址
- 以下是微信端
- $_W['attachurl'] http://bxy.x.com/attachment/
- $_W['os'] => mobile
- $_W["container"] => wechat 浏览器类型 wechat 微信浏览器 browser电脑端 web手机端 unknown
- $uid = $_W['member']['uid']
- $level = $_W['account']['level'] 公众号类型4是认证服务号
- $key = $_W['account']['key'];
- $secret = $_W['account']['secret'];
- $wxid = $_W['account']['original'] ; 原始id
- $openid = $_W['openid'] ;
- $_W['fans']['nickname'] 昵称
- $_W['fans']['follow'] 1是关注
- $_W['fans']['followtime']
- $_W['fans']['sex'] 1男2女0未知
- $_W['fans']['avatar'] 头像
- $_W['fans']['tag']
- [tag] => Array
- (
- [subscribe] => 1
- [openid] => ocUeXwINHvRqWPSldYZVO4dA_CzI
- [nickname] => yoby
- [sex] => 1
- [language] => zh_CN
- [city] => 朝阳
- [province] => 北京
- [country] => 中国
- [subscribe_time] => 1514525087
- [remark] =>
- [groupid] => 0
- [tagid_list] => Array
- (
- )
- [avatar] => http://wx.qlogo.cn/mmopen/PZI7pLaVibDNJVyEfFlibpEQYbx35UG0ibIs3wYo9pWpIE1dGSrddWYZTJwaQPXv5uVcrtaKycLS3eWawibWQOwJNw/132132
- )
- $_W['member']
- [member] => Array
- (
- [uid] => 13111
- [realname] => 李白
- [mobile] =>
- [email] => [email protected]
- [groupid] => 5
- [credit1] => 0.00
- [credit2] => 10001.00
- [credit6] => 0.00
- [groupname] => 默认会员组
- )
- 分享签名
- $wx = $_W['account']['jssdkconfig'];
- Array
- (
- [appId] => wx6a37
- [nonceStr] => Y4LolSN3oPLkPNgW
- [timestamp] => 1515655232
- [signature] => 57c90216f0b31835667b28423b948db3eb96c010
- => http://bxy.x.com
- [string1] => jsapi_ticket=kgt8ON7yVITDhtdw
- [name] => 公众号名称
- )
- {if $_W['isfounder']}
- 是管理员
- {/if}
预定义变量
- IA_ROOT E:/MicroEngine/pro 微擎目录
- ATTACHMENT_ROOT F:/wamp/www/attachment/ 附件目录
- MODULE_ROOT E:/MicroEngine/pro/addons/we7_store 当前模块目录
- MODULE_URL http://bxy.x.com/addons/ewei_shopv2/ 模块url
- TIMESTAMP 时间戳
- CLIENT_IP 客户IP
- $_W['current_module']['config']配置
读取配置参数
- $g = $this->module['config']['g'];
- 方法二,在方法1失效下
- $setting = pdo_get('uni_account_modules', array('module' => 'yoby_che', 'uniacid' => $params['uniacid']));
- $arr = iunserializer($setting['settings']);
以上变量在开发过程中为了使用方便,我们往往会追加一些数据,达到全局共用的目的。开发中遇到问题均可留言,不要加个人QQ了。