yii2支持了redis扩展,不需要在本地下载php的扩展库就可以很好的使用

1.下载windows的redis安装包打开cmd,进入安装包目录,使用redis-server.exe redis.conf,开启redis服务器,再打开一个cmd窗口,redis-cli.exe -h IP -p 6379

2.下载yii2的redis的安装包,下载地址为:https://github.com/yiisoft/yii2-redis

3.把下载的扩展文件放到vendor/yiisoft/下,命名为yii2_redis

4.修改vender/yiisoft/下的extensions.php,加入redis扩展

代码如图:

5.修改common/config.php文件,设置redis组件,代码如图

6.在控制器中可以测试

Yii::$app->redis->set('user','aaa');
Yii::$app->redis->set('user2','bbb');
Yii::$app->redis->set('user3','ccc');
Yii::$app->redis->set('user4','ddd');
Yii::$app->redis->get('user');//此时可以输出aaa
Yii::$app->redis->flushall();//删除redis中的所有数据

yii2的redis扩展使用的更多相关文章

  1. Yii2的redis扩展

    在应用的时候需要先对yii2进行扩展安装 如果装有composer直接运行 php composer.phar require --prefer-dist yiisoft/yii2-redis 当然也 ...

  2. php安装redis扩展'checking for igbinary includes... configure: error: Cannot find igbinary.h'解决方法

    今天准备给yii2安装redis扩展,先安装了redis服务,然后安装redis php官方扩展,在make的时候提示' checking for igbinary includes... confi ...

  3. Yii2使用Redis - 从安装redis到使用 [ 2.0 版本 ]

    Yii2使用Redis - 从安装redis到使用 [ 2.0 版本 ] 一.安装Redis和简单配置 1. 下载Redis安装包 地址:http://redis.io/download , 本文选择 ...

  4. 如何搭建redis扩展-Yii中文网

    原文链接: 如何搭建redis扩展http://www.yii-china.com/post/detail/43.html 安装redis扩展: 1.通过composer进行安装,到项目根目录cmd运 ...

  5. YII2 搭建redis拓展(教程)

    安装redis扩展: 1.通过composer进行安装,到项目根目录cmd运行(推荐) php composer.phar require --prefer-dist yiisoft/yii2-red ...

  6. YII2 搭建redis拓展

    安装redis扩展: 1.通过composer进行安装,到项目根目录cmd运行(推荐) php composer.phar require --prefer-dist yiisoft/yii2-red ...

  7. mac机上搭建php56/nginx 1.8.x/thinkphp 3.2.x/gearman扩展/seaslog扩展/redis扩展环境

    php的各种扩展配置起来实在不容易,记录一下备忘: 一.php56 安装 虽然php7出来了,但是没用过,不知道有没有坑,这里仍然使用php5.6版本 1.1 安装php/php-pfm brew u ...

  8. 编译安装PHP7并安装Redis扩展Swoole扩展

    编译安装PHP7并安装Redis扩展Swoole扩展 在编译php7的机器上已经有编译安装过php5.3以上的版本,从而依赖库都有了 本php7是编译成fpm-php 使用的, 如果是apache那么 ...

  9. win10 64位安装memcache扩展和开启redis扩展

    前面有关于win10下搭建wamp环境的介绍,在此不在赘述,php操作memcache有memcache库和memcached库,其中memcache是php内置的扩展库,支持面向对象和面向过程两种操 ...

随机推荐

  1. [LeetCode]题解(python):043-Multiply Strings

    题目来源 https://leetcode.com/problems/multiply-strings/ Given two numbers represented as strings, retur ...

  2. sql Server 使某一列的值等于行号

    declare @i INT update 表名 SET [列名]=@i,@i=@i+ WHERE 条件

  3. Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe

    class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } public class ...

  4. 使用 Redis 实现分布式系统轻量级协调技术

    http://www.ibm.com/developerworks/cn/opensource/os-cn-redis-coordinate/index.html 在分布式系统中,各个进程(本文使用进 ...

  5. LeetCode Peeking Iterator

    原题链接在这里:https://leetcode.com/problems/peeking-iterator/ 题目: Given an Iterator class interface with m ...

  6. LeetCode H-Index II

    原题链接在这里:https://leetcode.com/problems/h-index-ii/ 题目: Follow up for H-Index: What if the citations a ...

  7. python笔记 - day3

    python笔记 - day3 参考:http://www.cnblogs.com/wupeiqi/articles/5453708.html set特性: 1.无序 2.不重复 3.可嵌套 函数: ...

  8. 基础拾掇之——http基础

    基础拾掇之——http基础 http协议介绍 http:Hyper Text Transfer Protocol 超文本传输协议,是互联网应用最为广泛的一种网络协议,主要用于Web服务.通过计算机处理 ...

  9. 利用DBCC PAGE查看SQL Server中的表和索引数据

    16:08 2013-01-06 参考http://doc.chinaunix.net/sqlserver/200810/206034.shtmlDBCC PAGE|IND 参数 DBCC PAGE ...

  10. ASP: VS2015 + IIS Express 10 学习笔记

    首先搞清楚 ASP 与 ASP.NET 的区别(.asp与.aspx). https://msdn.microsoft.com/en-us/library/ms973813.aspx 环境配置: ht ...