-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
我用的环境
- PHP 版本:7.4.11
- overtrue/wechat 版本:^5.1.0
- 是否使用了框架?框架名称:是。laravel
问题及现象
需要返回微信sdk给前端使用,返回jssdk代码:
public function getJssdk(Request $request){
$url = $request->input("url");
$app = Factory::officialAccount(config("wechat.official_account.default"));
$jssdk = $app->jssdk->setUrl($url)->buildConfig(['scanQRCode', 'configWXDeviceWiFi','openWXDeviceLib','startScanWXDevice','getWXDeviceInfos'], true);
return $this->success(json_decode($jssdk,true));
}
今天突然前端的配网和扫码功能均不能使用,打开开发者工具发现报错:
Failed to cache access token
于是找到了有的解决办法:
use Symfony\Component\Cache\Simple\FilesystemCache;
$app = Factory::officialAccount($config);
$cache = new FilesystemCache('', 0, storage_path('framework/cache/data'));
$app->rebind('cache', $cache);
替换以后报了其他错误,于是结合报错,并且找到文档,替换缓存后:
$app = Factory::officialAccount(config("wechat.official_account.default"));
$client = new Client("tcp://127.0.0.1:6379");
$cache = new RedisAdapter($client);
$app->rebind('cache', $cache);
$jssdk = $app->jssdk->setUrl($url)->buildConfig(['scanQRCode', 'configWXDeviceWiFi','openWXDeviceLib','startScanWXDevice','getWXDeviceInfos'], true);
return $this->success(json_decode($jssdk,true));
想请问这种突然一下子无法写入cache可能是什么引起的,需要怎么修复?
Metadata
Metadata
Assignees
Labels
No labels
