php How to set the expiration time in redis: first open the corresponding PHP file; then set the expiration time of the redis key through "$redis->expireAt($key, $expireTime);".
#The operating environment of this article: Windows 7 system, PHP version 7.1, Dell G3 computer.
php redis set expiration time:
PHP sets the Redis key to be valid on that day
$redis->set($key,$value); $expireTime = mktime(23, 59, 59, date("m"), date("d"), date("Y")); //设置键的过期时间 $redis->expireAt($key, $expireTime);
Note that if the key here is a hash data structure, it is for the key, not If the field in the hash structure is set like this, the entire hash key will also be invalid.
[Recommended learning: "PHP Video Tutorial"]
The above is the detailed content of How to set expiration time in php redis. For more information, please follow other related articles on the PHP Chinese website!