windows下安裝並使用redis

來源:互聯網
上載者:User

標籤:

一,安裝redis

1.下載安裝包

https://github.com/MSOpenTech/redis/releases/

選擇一個最新版本 redis-2.8.19.zip

2.解壓到一個指定目錄

F:\redis-2.8.19

3.在cmd視窗,進入指定目錄,使用以下命令啟動服務

redis-server.exe  redis.windows.conf

4.雙擊開啟 redis-cli.exe ,如果不報錯,就連上了本機伺服器,測試下set,get命令

127.0.0.1:6379> set key test
OK
127.0.0.1:6379> get key
"test"

二,安裝redis擴充

1.下載安裝包,注意使用的版本

https://github.com/phpredis/phpredis/downloads

2.將下載的php_igbinary.dll,php_redis.dll放在php擴充目錄中(ext)

3.修改設定檔php.ini(添加extension=php_igbinary.dll,extension=php_redis.dll)

4.重新啟動服務,查看phpinfo(),尋找redis擴充是否安裝成功

三,使用php串連測試

$redis = new Redis();$redis->connect("127.0.0.1","6379");  $redis->set("say","Hello World");echo "<br/>".$redis->get("say");   $array = array(‘first_key‘=>‘first_val‘,‘second_key‘=>‘second_val‘,‘third_key‘=>‘third_val‘);$array_get = array(‘first_key‘,‘second_key‘,‘third_key‘);$redis->mset($array);echo "<br/>";print_r($redis->mget($array_get));





windows下安裝並使用redis

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.