如何读取redis中的key值中的结果
现在redis中有一个key,key名叫 wz_user
我读取wz_user
$redis->hGetAll("wz_user");
出现值:
???Array ( [1170202] => a:52:{ s:2:"id";s:7:"1170202"; s:3:"pid";s:1:"0";s:8:"user";s:11:"13520966111";s:8:"password";s:32:"04cb57ee0653c0f49b5ec72afcf9a15d";s:5:"image";s:0:"";s:5:"email";s:0:"";s:8:"sharenum";s:1:"0";s:9:"invitenum";s:1:"0";s:8:"clicknum";s:1:"0";s:5:"money";s:5:"1.000";s:6:"remain";s:5:"1.000";s:12:"invite_money";s:5:"0.000";s:8:"topmoney";s:5:"1.000";s:6:"amount";s:1:"0";s:6:"profit";s:1:"0";s:7:"levelid";s:1:"1";s:7:"account";s:0:"";s:6:"txname";s:0:"";s:3:"tip";s:0:"";s:5:"locks";s:1:"1";s:6:"adjust";s:0:"";s:2:"ip";s:14:"61.148.221.114";s:4:"area";s:0:"";s:8:"reg_type";s:1:"0";s:7:"created";s:10:"1437445187";s:7:"encrypt";s:6:"DtC1ju";s:6:"invite";s:0:"";s:7:"addtype";s:1:"0";s:2:"nc";s:1:"0";s:5:"isOne";s:1:"1";s:6:"freeze";s:1:"0";s:8:"freetime";s:1:"0";s:6:"keyong";s:1:"0";s:5:"close";s:1:"0";s:9:"closetime";s:1:"0";s:10:"tel_status";s:1:"1";s:7:"payment";s:1:"0";s:10:"paymentime";s:1:"0";s:8:"is_white";s:1:"0";s:9:"whitetime";s:1:"0";s:5:"token";s:0:"";s:8:"platform";s:1:"0";s:8:"is_water";s:1:"0";s:9:"watertime";s:1:"0";s:10:"active_val";s:1:"0";s:5:"score";s:5:"0.000";s:10:"sentizinum";s:1:"0";s:10:"teamleader";s:1:"0";s:15:"distributor_img";s:0:"";s:17:"distributor_money";s:5:"0.000";s:16:"distributor_team";s:1:"0";s:18:"distributor_indent";s:1:"0";} )
类似于值里面的 s:2:"id";s:7:"1170202"; 在数据库中是id=1170202
s:3:"pid";s:1:"0";s:8:"user";s:11:"13520966111"; 数据库中user = 13520966111
应该如何把这些值从redis的value中单独取出来呢?
回复讨论(解决方案)
hget就是取一个数据呀。
你的数据结构是什么样子的
这是序列化后的值,可用 unserialize 反序列化
感谢xuzuning , 遍历一下,得到值后,反序列化一下就可以了
Array( [id] => 1170202 [pid] => 0 [user] => 13520966111 [password] => 04cb57ee0653c0f49b5ec72afcf9a15d [image] => [email] => [sharenum] => 0 [invitenum] => 0 [clicknum] => 0 [money] => 1.000 [remain] => 1.000 [invite_money] => 0.000 [topmoney] => 1.000 [amount] => 0 [profit] => 0 [levelid] => 1 [account] => [txname] => [tip] => [locks] => 1 [adjust] => [ip] => 61.148.221.114 [area] => [reg_type] => 0 [created] => 1437445187 [encrypt] => DtC1ju [invite] => [addtype] => 0 [nc] => 0 [isOne] => 1 [freeze] => 0 [freetime] => 0 [keyong] => 0 [close] => 0 [closetime] => 0 [tel_status] => 1 [payment] => 0 [paymentime] => 0 [is_white] => 0 [whitetime] => 0 [token] => [platform] => 0 [is_water] => 0 [watertime] => 0 [active_val] => 0 [score] => 0.000 [sentizinum] => 0 [teamleader] => 0 [distributor_img] => [distributor_money] => 0.000 [distributor_team] => 0 [distributor_indent] => 0)
xuzuning 感谢,这个问题已经搞定,
我现在还有个问题,想问一下
因为这个库是一个联合查询的库,里面有很多联合查询的条件,所以采用的redis,现在想把查询的信息不经过mysql,直接从redis里面查,如何利用得到的这些得到的值当判断条件?
比如redis中,在这个wz_user key中的数据一共有100W条,现在我想把key中存入的数据作为数据,然后判断 user = 13520966111 的时候,从redis中取出这条数据 , 或者是当locks = 1 时,取出这100W条中所有的locks=1的数据。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:
