Home > php教程 > php手册 > body text

ThinkPHP3.2.3使用redis示例

WBOY
Release: 2016-06-07 11:37:12
Original
1927 people have browsed it

我的服务器是Windows server 2008 64位的
使用的是phpstudy php 54n Apache+MySQL
使用的ThinkPHP3.2.3框架
下载附件按照文档弄下基本搞定
不过没有安装redis的方法在里面,只有文档和redis 扩展这些
安装redis这个百度下呗
下面的代码 文档里都有:config.php 加如下代码 ip根据自己的来修改<br> 'DATA_CACHE_PREFIX' => 'Redis_',//缓存前缀<br> 'DATA_CACHE_TYPE'=>'Redis',//默认动态缓存为Redis<br> 'REDIS_RW_SEPARATE' => true, //Redis读写分离 true 开启<br> 'REDIS_HOST'=>'192.168.91.102', //redis服务器ip,多台用逗号隔开;读写分离开启时,第一台负责写,其它[随机]负责读;<br> 'REDIS_PORT'=>'6379',//端口号<br> 'REDIS_TIMEOUT'=>'300',//超时时间<br> 'REDIS_PERSISTENT'=>false,//是否长连接 false=短连接<br> 'REDIS_AUTH'=>'',//AUTH认证密码<br> <br> 任意控制器下的方法下写:<br> 测试redis<br> $redis = new \Redis();<br> $redis->connect('192.168.91.102',6379);<br> $redis->set('test','hello world!');<br> echo $redis->get("test");

附件 redis.rar ( 423.84 KB 下载:152 次 )

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!