微信第三方平台,其他所以地方需要用到开放平台的配置,都从下面方法调用,确保一致。
public function openPlatform()
{
$app = Factory::openPlatform(config("wechat.open_platform.default"));
$predis = app('redis')->connection()->client(); // connection($name), $name 默认为 `default`
$cache = new RedisCache($predis);
$app->rebind('cache', $cache);
return $app;
}
只要确保所有实例化openPlatform的地方都是通过上面的方法得到,就可达到项目迁移,服务器变更的情况下不影响功能使用。(注:ip白名单问题)。