首页 > Windows开发 > 详细

window下php5安装redis扩展

时间:2017-09-26 13:29:13      阅读:298      评论:0      收藏:0      [点我收藏+]

最近想在5.6版本的开发环境装一下redis的扩展,结果找了半天都是失效链接,特此做下备份

https://pecl.php.net/package/redis/2.2.7/windows

技术分享

然后,把php_redis.dll放到php的ext文件夹下

 技术分享

 

最后在php.ini加上

extension=php_redis.dll

  

重启环境运行下面代码,前提是已启动redis

技术分享

$redis = new Redis();
$redis->connect(‘127.0.0.1‘, 6379);
echo "Connection to server sucessfully";
//查看服务是否运行
echo "Server is running: " . $redis->ping();

执行脚本,输出结果为:

Connection to server sucessfully
Server is running: PONG

 

//连接本地的 Redis 服务
   $redis = new Redis();
   $redis->connect(‘127.0.0.1‘, 6379);
   echo "Connection to server sucessfully";
   //设置 redis 字符串数据
   $redis->set("tutorial-name", "Redis tutorial");
   // 获取存储的数据并输出
   echo "Stored string in redis:: " . $redis->get("tutorial-name");

执行脚本,输出结果为:

Connection to server sucessfully
Stored string in redis:: Redis tutorial

 

window下php5安装redis扩展

原文:http://www.cnblogs.com/cxscode/p/7596252.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!