💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 第一课全局变量 全局的变量 ``` <pre class="calibre14">``` global $_W<span class="token2">,</span>$_GPC<span class="token2">;</span> $_W<span class="token2">[</span><span class="token4">'siteroot'</span><span class="token2">]</span> http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>bxy<span class="token2">.</span>x<span class="token2">.</span>com<span class="token">/</span> $_W<span class="token2">[</span><span class="token4">'account'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'name'</span><span class="token2">]</span> 公众号名称 $_W<span class="token2">[</span><span class="token4">'isajax'</span><span class="token2">]</span> 是否ajax $_W<span class="token2">[</span><span class="token4">'ispost'</span><span class="token2">]</span> 是否POST $_W<span class="token2">[</span><span class="token4">'uniacid'</span><span class="token2">]</span> 公众号id $_W<span class="token2">[</span><span class="token4">'siteurl'</span><span class="token2">]</span> 当前页面地址 以下是微信端 $_W<span class="token2">[</span><span class="token4">'attachurl'</span><span class="token2">]</span> http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>bxy<span class="token2">.</span>x<span class="token2">.</span>com<span class="token">/</span>attachment<span class="token">/</span> $_W<span class="token2">[</span><span class="token4">'os'</span><span class="token2">]</span> <span class="token">=</span><span class="token">></span> mobile $_W<span class="token2">[</span><span class="token4">"container"</span><span class="token2">]</span> <span class="token">=</span><span class="token">></span> wechat 浏览器类型 wechat 微信浏览器 browser电脑端 web手机端 unknown $uid <span class="token">=</span> $_W<span class="token2">[</span><span class="token4">'member'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'uid'</span><span class="token2">]</span> $level <span class="token">=</span> $_W<span class="token2">[</span><span class="token4">'account'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'level'</span><span class="token2">]</span> 公众号类型<span class="token3">4</span>是认证服务号 $key <span class="token">=</span> $_W<span class="token2">[</span><span class="token4">'account'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'key'</span><span class="token2">]</span><span class="token2">;</span> $secret <span class="token">=</span> $_W<span class="token2">[</span><span class="token4">'account'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'secret'</span><span class="token2">]</span><span class="token2">;</span> $wxid <span class="token">=</span> $_W<span class="token2">[</span><span class="token4">'account'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'original'</span><span class="token2">]</span> <span class="token2">;</span> 原始id $openid <span class="token">=</span> $_W<span class="token2">[</span><span class="token4">'openid'</span><span class="token2">]</span> <span class="token2">;</span> $_W<span class="token2">[</span><span class="token4">'fans'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'nickname'</span><span class="token2">]</span> 昵称 $_W<span class="token2">[</span><span class="token4">'fans'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'follow'</span><span class="token2">]</span> <span class="token3">1</span>是关注 $_W<span class="token2">[</span><span class="token4">'fans'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'followtime'</span><span class="token2">]</span> $_W<span class="token2">[</span><span class="token4">'fans'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'sex'</span><span class="token2">]</span> <span class="token3">1</span>男<span class="token3">2</span>女<span class="token3">0</span>未知 $_W<span class="token2">[</span><span class="token4">'fans'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'avatar'</span><span class="token2">]</span> 头像 $_W<span class="token2">[</span><span class="token4">'fans'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'tag'</span><span class="token2">]</span> <span class="token2">[</span>tag<span class="token2">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token2">(</span> <span class="token2">[</span>subscribe<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1</span> <span class="token2">[</span>openid<span class="token2">]</span> <span class="token">=</span><span class="token">></span> ocUeXwINHvRqWPSldYZVO4dA_CzI <span class="token2">[</span>nickname<span class="token2">]</span> <span class="token">=</span><span class="token">></span> yoby <span class="token2">[</span>sex<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1</span> <span class="token2">[</span>language<span class="token2">]</span> <span class="token">=</span><span class="token">></span> zh_CN <span class="token2">[</span>city<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 朝阳 <span class="token2">[</span>province<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 北京 <span class="token2">[</span>country<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 中国 <span class="token2">[</span>subscribe_time<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1514525087</span> <span class="token2">[</span>remark<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token2">[</span>groupid<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">0</span> <span class="token2">[</span>tagid_list<span class="token2">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token2">(</span> <span class="token2">)</span> <span class="token2">[</span>avatar<span class="token2">]</span> <span class="token">=</span><span class="token">></span> http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>wx<span class="token2">.</span>qlogo<span class="token2">.</span>cn<span class="token">/</span>mmopen<span class="token">/</span>PZI7pLaVibDNJVyEfFlibpEQYbx35UG0ibIs3wYo9pWpIE1dGSrddWYZTJwaQPXv5uVcrtaKycLS3eWawibWQOwJNw<span class="token">/</span><span class="token3">132132</span> <span class="token2">)</span> $_W<span class="token2">[</span><span class="token4">'member'</span><span class="token2">]</span> <span class="token2">[</span>member<span class="token2">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token2">(</span> <span class="token2">[</span>uid<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">13111</span> <span class="token2">[</span>realname<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 李白 <span class="token2">[</span>mobile<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token2">[</span>email<span class="token2">]</span> <span class="token">=</span><span class="token">></span> c00c4665e89602a8acb8a640d2fa8e3d@we7<span class="token2">.</span>cc <span class="token2">[</span>groupid<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">5</span> <span class="token2">[</span>credit1<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">0.00</span> <span class="token2">[</span>credit2<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">10001.00</span> <span class="token2">[</span>credit6<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">0.00</span> <span class="token2">[</span>groupname<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 默认会员组 <span class="token2">)</span> 分享签名 $wx <span class="token">=</span> $_W<span class="token2">[</span><span class="token4">'account'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'jssdkconfig'</span><span class="token2">]</span><span class="token2">;</span> Array <span class="token2">(</span> <span class="token2">[</span>appId<span class="token2">]</span> <span class="token">=</span><span class="token">></span> wx6a37 <span class="token2">[</span>nonceStr<span class="token2">]</span> <span class="token">=</span><span class="token">></span> Y4LolSN3oPLkPNgW <span class="token2">[</span>timestamp<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1515655232</span> <span class="token2">[</span>signature<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">57</span>c90216f0b31835667b28423b948db3eb96c010 <span class="token2">[</span>url<span class="token2">]</span> <span class="token">=</span><span class="token">></span> http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>bxy<span class="token2">.</span>x<span class="token2">.</span>com <span class="token2">[</span>string1<span class="token2">]</span> <span class="token">=</span><span class="token">></span> jsapi_ticket<span class="token">=</span>kgt8ON7yVITDhtdw <span class="token2">[</span>name<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 公众号名称 <span class="token2">)</span> <span class="token2">{</span><span class="token5">if</span> $_W<span class="token2">[</span><span class="token4">'isfounder'</span><span class="token2">]</span><span class="token2">}</span> 是管理员 <span class="token2">{</span><span class="token">/</span><span class="token5">if</span><span class="token2">}</span> ``` ``` 预定义常量 ``` <pre class="calibre14">``` IA_ROOT E<span class="token2">:</span><span class="token">/</span>MicroEngine<span class="token">/</span>pro 微擎目录 ATTACHMENT_ROOT F<span class="token2">:</span><span class="token">/</span>wamp<span class="token">/</span>www<span class="token">/</span>attachment<span class="token">/</span> 附件目录 MODULE_ROOT E<span class="token2">:</span><span class="token">/</span>MicroEngine<span class="token">/</span>pro<span class="token">/</span>addons<span class="token">/</span>we7_store 当前模块目录 MODULE_URL http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>bxy<span class="token2">.</span>x<span class="token2">.</span>com<span class="token">/</span>addons<span class="token">/</span>ewei_shopv2<span class="token">/</span> 模块url TIMESTAMP 时间戳 CLIENT_IP 客户IP $_W<span class="token2">[</span><span class="token4">'current_module'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'config'</span><span class="token2">]</span>配置 ``` ``` 读取配置参数 ``` <pre class="calibre16">``` $g <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>module<span class="token2">[</span><span class="token4">'config'</span><span class="token2">]</span><span class="token2">[</span><span class="token4">'g'</span><span class="token2">]</span><span class="token2">;</span> 方法二<span class="token2">,</span>在方法<span class="token3">1</span>失效下 $setting <span class="token">=</span> <span class="token1">pdo_get</span><span class="token2">(</span><span class="token4">'uni_account_modules'</span><span class="token2">,</span> <span class="token1">array</span><span class="token2">(</span><span class="token4">'module'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'yoby_che'</span><span class="token2">,</span> <span class="token4">'uniacid'</span> <span class="token">=</span><span class="token">></span> $params<span class="token2">[</span><span class="token4">'uniacid'</span><span class="token2">]</span><span class="token2">)</span><span class="token2">)</span><span class="token2">;</span> $arr <span class="token">=</span> <span class="token1">iunserializer</span><span class="token2">(</span>$setting<span class="token2">[</span><span class="token4">'settings'</span><span class="token2">]</span><span class="token2">)</span><span class="token2">;</span> ``` ```