短信验证
This commit is contained in:
30
extends/redis/Redisop.php
Normal file
30
extends/redis/Redisop.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace extend\redis;
|
||||
|
||||
class Redisop {
|
||||
|
||||
private $redis;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->redis = new \Redis();
|
||||
$this->redis->connect('127.0.0.1', 6379);
|
||||
$this->redis->auth('123456');
|
||||
}
|
||||
|
||||
|
||||
public function setOfTime($key = '', $value = '') {
|
||||
if (empty($key)) {
|
||||
die;
|
||||
}
|
||||
$this->redis->set( $key , $value);
|
||||
$this->redis->expire($key,60);
|
||||
}
|
||||
|
||||
public function get($key = '') {
|
||||
if (empty($key)) {
|
||||
die;
|
||||
}
|
||||
return $this->redis->get( $key );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user