WRONGTYPE Operation against a key holding the wrong kind of value php(WRONGTYPE 针对持有错误类型值 php 的键的操作)
问题描述
我正在将 Laravel 与 Redis 一起使用.当我尝试通过 get 方法访问密钥时,出现以下错误针对持有错误类型值的密钥的错误类型操作"
Hi I am using Laravel with Redis .When I am trying to access a key by get method then get following error "WRONGTYPE Operation against a key holding the wrong kind of value"
我正在使用以下代码访问键值 -
I am using following code to access the key value -
我使用此代码从 redis 获取数据
i use this code for get data from redis
$values = "l_messages";
$value = $redis->HGETALL($values);
print($value);
推荐答案
Redis 支持 6 种数据类型.您需要知道一个键映射到什么类型的值,至于每个数据类型,检索它的命令是不同的.
Redis supports 6 data types. You need to know what type of value that a key maps to, as for each data type, the command to retrieve it is different.
这里是检索键值的命令:
Here are the commands to retrieve key value:
- 如果值是字符串类型 ->GET
- 如果值是哈希类型 ->HGETALL
- 如果值是列表类型 ->lrange
<开始><end> - 如果值是集合类型 ->成员
- 如果值是排序集类型 ->ZRANGEBYSCORE
<分钟><max> - 如果值是流类型 ->xread count
流
.https://redis.io/commands/xread
使用 TYPE
命令检查一个键的值的类型映射到:
Use the TYPE
command to check the type of value a key is mapping to:
- 输入
这篇关于WRONGTYPE 针对持有错误类型值 php 的键的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:WRONGTYPE 针对持有错误类型值 php 的键的操作


- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01