EasyWechat 公众号 AccessToken 共享方案
- 配置
EasyWechat
缓存方式采用 Redis
- 例如
公众号
缓存 Cache Key
的生成方式如下
$cacheKey = "easywechat.kernel.access_token." . md5(json_encode([
'grant_type' => 'client_credential',
'appid' => $this->app['config']['app_id'],
'secret' => $this->app['config']['secret'],
]));
- 例如
小程序
缓存 Cache Key
的生成方式如下 注意:小程序的 appid
和 secret
是不一致的
$cacheKey = "easywechat.kernel.access_token." . md5(json_encode([
'grant_type' => 'client_credential',
'appid' => $this->app['config']['app_id'],
'secret' => $this->app['config']['secret'],
]));
- 得出结论:只要同处于一个
Redis
下面的都可以共享