当前位置:网站首页> YII2框架手动安装Redis扩展的过程
YII2框架手动安装Redis扩展的过程
2022-06-09 15:04:00 【1024问】
1.需要下载yii2-redis的master分支代码:https://github.com/yiisoft/yii2-redis
windows版本composer下载: https://getcomposer.org/download/
2.解压复制到vendor/yiisoft 下面
3.yiisoft下面extensions.php里面增加
'yiisoft/yii2-redis' =>array ('name' => 'yiisoft/yii2-redis','version' => '2.0.5.0','alias' =>array ('@yii/redis' => $vendorDir . '/yiisoft/yii2-redis',),),4.在composer.json里面增加

"autoload": {"psr-4":"yii\\redis\\": "/yii2-redis/src/"}},进入项目目录运行: composer dumpautoload
5.修改composer_psr4.php 找到'yii\\redis\\' 改为: 'yii\\redis\\' => array($vendorDir . '/yiisoft/yii2-redis/src'),
6.修改autoload_static.php 找到'yii\\redis\\' 改为 :'yii\\redis\\' =>array ( 0 => __DIR__ . '/..' . '/yiisoft/yii2-redis/src',),
7.web.php里面增加
'redis' =>['class' => 'yii\redis\Connection','hostname' => '127.0.0.1', #改为自己的redis服务器'port' => 6379,'database' => 0,'connectionTimeout' => 5],可以使用Yii:$app->redis->set('foo','Hello');Yii:$app->redis->get('foo');进行测试下。
到此这篇关于YII2框架手动安装Redis扩展的文章就介绍到这了,更多相关YII2安装redis扩展内容请搜索软件开发网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件开发网!
边栏推荐
- 品牌与产品的二律背反
- @Enablefeignclients annotation source code analysis
- Huawei announced its top ten inventions: efficient additive network and multi-objective game intelligent driving
- 网络安全等级测评和商用密码应用安全性评估是一回事吗?
- ECCV 2020 | STAR:基于Transformer的行人轨迹预测模型(二)
- 【MUI+Flask+MongoDB+HBuilderX】APP开发之答题积分逻辑详解
- ^28JS是单线程的
- Les salaires restent inchangés, avec seulement quatre jours de travail par semaine, et le Royaume - Uni expérimente la plus grande « Semaine de travail de quatre jours » au monde.
- 薪酬不变,每周只上四天班,英国试行全球最大规模“四天工作制”
- 你好,欢迎访问我的博客
猜你喜欢

如何优雅的自定义 ThreadPoolExecutor 线程池

497. 非重叠矩形中的随机点
![[paper] cascade r-cnn: delving into high quality object detection](/img/7d/f5ebd89cd8963fe45d4894077ca25b.png)
[paper] cascade r-cnn: delving into high quality object detection

细说腾讯如何做到直播延时降低90%以上方案

新冠病毒的最终解药

List used by icomponent of unity dots

鸿蒙移植i.mx6ull(五) 移植概述

一年进账34.46亿,又一个福建老乡要IPO了

Using kubekey to build kubernetes/kubesphere environment“

Hongmeng transplantation i.mx6ull (V) overview of transplantation
随机推荐
Taoist friend, what have you done with redis?
497. 非重叠矩形中的随机点
百度一程序员被判:不满他人接手项目、彰显自己作用、多次对数据库进行删改,犯破坏计算机信息系统罪
小程序中实现视图懒加载
C#/VB.NET 在Word转PDF时生成目录书签
Some tool functions commonly used in JS projects
Gaussdb (DWS) functions and supporting tools [Gauss is not a mathematician this time]
jupyter lab学习笔记
技术干货 | Linkis实践:新引擎实现流程解析
Google installs the impression note clipping plug-in
Is it safe to open an account in an external market or domestic futures?
135. 分发糖果
一年进账34.46亿,又一个福建老乡要IPO了
JS implements JSON array merging and de duplication
被大厂认可的测试报告怎么写?拥有这30套模板的我彻底起飞
【四、基于域名的几种互联网企业需求分析】
【五、反向代理及其相关配置】
Global backbone network was interrupted for 4 hours: Google cloud, AWS, azure, etc. were affected
Due to the suspension of Russian business: IBM Q1 lost 2billion, Cisco 1.3 billion, Adobe 500million, HP 6.7 billion, uipath 100million
Les salaires restent inchangés, avec seulement quatre jours de travail par semaine, et le Royaume - Uni expérimente la plus grande « Semaine de travail de quatre jours » au monde.