Cache 中set到华为云redis服务的值乱码

程序媛

php 7.x
composer require -W illuminate/redis ^8.2.0 symfony/cache ^5.2
以上是使用https://www.workerman.net/doc/webman/db/cache.html 此插件

redis配置文件内容:/config/redis.php


php文件:

<?php 
namespace app\api\controller;
use support\Request;
class IndexController{
    public function index(Request $request){

        $key="Query_hw_token";
        $accesstoken="x-li5ig8jsiorznv7umno52q0amqru85dd3u5edhfzlcuko8rs44iopicbfuft489dbws56ms9ob5dvyaovvc9iqhfpj3vtgtgmpfweqilrw7tdftd4b6rhh2lmpsbs43y";
        Cache::set($key, $accesstoken,25);
        return json(['code' => 0, 'accesstoken' => $accesstoken]);
    }
}
 ?>


使用Redis DeskTop Manager工具查看值为:

环境部署1:
webman服务在华为云服务器,操作系统版本信息:Linux version 3.10.0-1160.108.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Thu Jan 25 16:17:31 UTC 2024

环境部署2:
webman服务在阿里云服务器,操作系统版本信息:Linux version 5.10.134-13.1.al8.x86_64 (mockbuild@kojid011139182114.na61) (gcc (GCC) 10.2.1 20200825 (Alibaba 10.2.1-3 2.32), GNU ld version 2.35-12.2.al8) #1 SMP Mon Feb 6 14:54:50 CST 2023
redis服务使用的是华为云的redis服务。

问题---
环境部署1:redis的值有前缀 \x00\x00\x00\x02\x11\x8 需要修改哪里去掉这个前缀?
环境部署2 redis的值没有前缀,存储正常。

现在的解决办法是,不用cache,直接使用:composer require -W illuminate/redis illuminate/events 存储,没有前缀。此操作使用的插件是:https://www.workerman.net/doc/webman/db/redis.html

217 1 0
1个回答

胡桃

illuminate/redissymfony/cache 互不依赖,这引入也是独树一帜了。

代码演示也没有,截图也没有,配置也没有,估计只有神仙知道问题出在哪。

×
🔝