标签:end object oba redis scl exit null auth nec
<pre>
<?php
/**
* This is a Redis exntend class
*/
class RedisClient
{
private static $instance = NULL;
/**
* Get a instance of MyRedisClient
*
* @param string $key
* @return object
*/
public static function getInstance()
{
if (!self::$instance) {
$redis = new \Redis();
$redis->connect(‘127.0.0.1‘, 6379);
$redis->auth(‘23‘);
self::$instance = $redis;
}
return self::$instance;
}
}
$redis = \RedisClient::getInstance();
$redis->incr(‘moban_fangwen‘);
print_r($redis->get(‘moban_fangwen‘));
exit();
?>
</pre>
标签:end object oba redis scl exit null auth nec
原文地址:https://www.cnblogs.com/newmiracle/p/11871492.html