通過composer安裝 redis WINDOWS下

來源:互聯網
上載者:User

標籤:sof   class   decode   適用於   his   database   alt   window   redis   

首先安裝一個叫composer的軟體

裝的過程中有個選擇按鍵叫browe選擇你的phpstudy裡面的php裡面的php5.6.27裡面的ext裡面的php.exe(好像是),(版本優先選擇php5.6),

然後傻瓜式安裝 開啟CMD;輸入composer,然後進入到你的phpstudy裡你的項目目錄下,然後輸入輸入 composer selfupdate ,找到yii架構下的 composer.json ,在yiisoft/yii2-swiftmailer,下邊加上 "yiisoft/yii2-smarty": "*", "yiisoft/yii2-redis": "*",然後找yiisoft/yii2/composer.json的bower-asset/yii2-pjax": "~2.0.1", 下邊寫上 "yiisoft/yii2-smarty": "*", "yiisoft/yii2-redis": "*"然後進入common的main-local.php寫上‘redis‘ => [ ‘class‘ => ‘yii\redis\Connection‘, ‘hostname‘ => ‘127.0.0.1‘, ‘port‘ => 6379, ‘database‘ => 0,//預設有16個庫0-15,如果是叢集的話,只有一個0。 ], 然後進入cmd,輸入composer update --prefer-dist yii-soft/yii2-redis,裝完後 進入控制器 $redis = Yii::$app->redis; $redis->set(‘city‘, ‘Beijing‘); $value = $redis->get(‘city‘),ture); echo ‘The value of city in redis is: ‘, $value; 然後查看瀏覽器效果。 (例 $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]);) !!!! 次效果只是適用於大家都裝了composer這個軟體

 

例子

 

 

進入composer.json

 

然後

 

 就實現了

 

通過composer安裝 redis WINDOWS下

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.