easywechat6.x版本如何自定义缓存为redis?

问题描述

目前多台服务器运行easywechat,想共用access_token缓存。

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
最佳答案

自问自答..以下是实现代码.

        $this->app = new Application([
            'app_id'  => parameter('wechat_mini_app_appid'),
            'secret'  => parameter('wechat_mini_app_secret'),
            'token'   => parameter('wechat_mini_app_token'),
            'aes_key' => parameter('wechat_mini_app_aes_key'),
        ]);
        // 设置easywechat的缓存为laravel自带的缓存
        $this->app->setCache(app('cache.store'));
2年前 评论
讨论数量: 3

自问自答..以下是实现代码.

        $this->app = new Application([
            'app_id'  => parameter('wechat_mini_app_appid'),
            'secret'  => parameter('wechat_mini_app_secret'),
            'token'   => parameter('wechat_mini_app_token'),
            'aes_key' => parameter('wechat_mini_app_aes_key'),
        ]);
        // 设置easywechat的缓存为laravel自带的缓存
        $this->app->setCache(app('cache.store'));
2年前 评论

我的方案是调用同一台服务器的某个接口获取。固定的一台。

2年前 评论
91it (楼主) 2年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!