Installation of Redis Windows via composer

Source: Internet
Author: User
Tags redis windows yii

First, install a software called composer.

Install the process has a choice button called Browe Choose your phpstudy inside the PHP inside of the php5.6.27 inside ext php.exe (like), (version preference php5.6),

Then the idiot installs open cmd, enters composer, then enters into your phpstudy in your project directory, then enters the input composer SelfUpdate, finds Composer.json under the Yii framework, yiisoft/ Yii2-swiftmailer, add "Yiisoft/yii2-smarty" below: "*", "Yiisoft/yii2-redis": "*", then find yiisoft/yii2/ Composer.json Bower-asset/yii2-pjax ":" ~2.0.1 ", below the" Yiisoft/yii2-smarty ":" * "," Yiisoft/yii2-redis ":" * " Then go into Common's main-local.php and write ' redis ' = [' class ' = ' yii\redis\connection ', ' hostname ' = ' 127.0.0.1 ', ' Port ' =& Gt 6379, ' database ' = 0,//has 16 library 0-15 default, if it is a cluster, there is only one 0. ], then go to cmd, enter composer update--prefer-dist Yii-soft/yii2-redis, and enter the controller after loading $redis = Yii:: $app->redis; $redis->set (' City ', ' Beijing '); $value = $redis->get (' City '), ture); Echo ' The value of city in Redis is: ', $value; Then look at the browser effect. (Example $ar =json_encode ($array); $redis = Yii:: $app->redis; $redis->set (' City ', $ar); $value = Json_decode ($redis) Get (' City '), true); return $this->render (' Index ', [' list ' = + $value]);)!!! The second effect is only applicable to everyone who has installed composer this software

Example

Enter Composer.json

And then

It was realized.

Installation of Redis Windows via composer

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.