laravel EasyWeChat acctoken保存到redis
$config = [
'app_id' => '',
'secret' => '',
// 下面为可选项
// 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
'response_type' => 'array'
];
$app = Factory::miniProgram($config);
$predis = app('redis')->connection()->client(); // connection($name), $name 默认为 `default`
$cache = new \Symfony\Component\Cache\Adapter\RedisAdapter($predis);
$app->rebind('cache', $cache);
$access_token = $app->access_token->getToken();
dd($access_token);
本文由:xiaoshu168 作者:xiaoshu611发表,转载请注明来源!