🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 基础 [TOC] ## 配置 ``` //微信配置 $config = [ /* |-------------------------------------------------------------------------- | token |-------------------------------------------------------------------------- | 微信绑定验证时使用的token, 需要与微信公众号后台保持一致 | http://mp.weixin.qq.com/wiki/8/f9a0b8382e0b77d87b3bcc1ce6fbc104.html */ 'token' => '808c2b8e93acdda22e', /* |-------------------------------------------------------------------------- | 缓存目录 |-------------------------------------------------------------------------- | 用于缓存ACCESS_TOKEN等数据 */ 'cache_path' => 'storage/houdunren/wechat', /* |-------------------------------------------------------------------------- | encodingaeskey |-------------------------------------------------------------------------- | 需要与微信公众号后台保持一致 | http://mp.weixin.qq.com/wiki/8/f9a0b8382e0b77d87b3bcc1ce6fbc104.html */ 'encodingaeskey' => '808c2b8e93acdda22e9ec7716515a5e0808c2b8e93a', /* |-------------------------------------------------------------------------- | 公众号身份标识 |-------------------------------------------------------------------------- | 填写公众号认证后腾讯官网发来的邮件中的appid */ 'appid' => 'wxc47243ed572e273d', /* |-------------------------------------------------------------------------- | appsecret |-------------------------------------------------------------------------- | 公众平台API的权限获取所需密钥Key | 需要与微信公众号后台保持一致 */ 'appsecret' => '2c1d1d3a3b9f054bcd60983083da68a3', /* |-------------------------------------------------------------------------- | 支付商户号 |-------------------------------------------------------------------------- | 微信发来的邮件中的微信支付商户号 */ 'mch_id' => '', /* |-------------------------------------------------------------------------- | 商户支付密钥 |-------------------------------------------------------------------------- | 用于生成支付签名等使用 | 登录微信支付-商户平台 API安全中获取 | https://pay.weixin.qq.com/index.php/core/cert/api_cert */ 'key' => '', /* |-------------------------------------------------------------------------- | 证书 |-------------------------------------------------------------------------- | 使用微信红包接口等功能时需要的证书 | 请登录微信支付后台下载,并保证文件目录正确 */ 'apiclient_cert' => 'cert/apiclient_cert.pem', 'apiclient_key' => 'cert/apiclient_key.pem', 'rootca' => 'cert/rootca.pem', ]; ~~~ (new WeChat)->config($config); ~~~ ``` 不是说所有配置项都需要设置,比如你公众号不需要支付,那有关支持的配置就不需要设置了。