tp5下的Redis操作类,对原Redis的二次封装,支持编辑器识别

发布于:2020-03-06 17:08:48

tp5redis

tp5下的Redis操作类,对原Redis的二次封装,支持编辑器识别

安装

composer require "xiucaiwu/tp5redis:1.0.*"

配置

tp5.0

config.php
'redis'                  => [
	'host' => '127.0.0.1', // redis主机
	'port' => '', // redis端口
	'password' => '', // 密码
	'select' => 0, // 操作库
	'expire' => 0, // 有效期(秒)
	'timeout' => 0, // 超时时间(秒)
	'persistent' => true, // 是否长连接
	'prefix' => '', //前缀
]

tp5.1

config/redis.php
return [
	'host' => '127.0.0.1', // redis主机
	'port' => '', // redis端口
	'password' => '', // 密码
	'select' => 0, // 操作库
	'expire' => 0, // 有效期(秒)
	'timeout' => 0, // 超时时间(秒)
	'persistent' => true, // 是否长连接
	'prefix' => '', //前缀
];

例子

<?php
	namespace app\index\controller;
	use tp5redis\Redis;

	class index
	{
		public function test()
		{
			  Redis::set('abc',111);
			  $res = Redis::get('abc');
			  var_dump($res);  //输出111代表成功
		}
	}


阅读 221+

一片空白

父爱如山,不善表达。回想十多年前,总记得父亲有个宽厚的肩膀,小小的自己跨坐在上面,越过人山人海去看更广阔的天空,那个时候期望自己有一双翅膀,能够像鸟儿一样飞得高,看得远。虽然父亲有时会和自己开玩笑,但在做错事的时候会受到严厉的训斥。父亲有双粗糙的大手掌。