搜尋
首頁後端開發PHP7php7.0怎麼安裝redis擴充

php7.0怎麼安裝redis擴充

Mar 15, 2021 am 10:06 AM
php7

php7.0安装redis扩展的方法:首先查看自己PHP的版本;然后下载并解压redis;最后在php.ini文件中添加“extension=php_redis.dll”即可。

php7.0怎麼安裝redis擴充

本文操作环境:windows7系统、PHP7.0版,DELL G3电脑

1、查看自己PHP的版本

echo phpinfo()
<code style="white-space: initial"><span class="hljs-comment"><span style="font-size: 18px">查看自己的版本:</span><br/><img src="/static/imghwm/default1.png"  data-src="https://img.php.cn/upload/article/000/000/020/30fcdd5ec941ccda41fd0d169dbf0349-0.png?x-oss-process=image/resize,p_40"  class="lazy" alt=""/><br/><br/><span   style="max-width:90%">VC是14,系统是64位的,所以一定要选对版本,因为这个版本我折腾了好久。<br/><br/><span style="font-family: Microsoft YaHei">2、根据自己的PHP版本、编译器的版本以及cpu</span><br/>我的是php是7.0 、VC14、X64。附上我的下载链接redis、igbinary的链接:<br/>Redis:<br/>http://windows.php.net/downloads/pecl/releases/redis/<br/></span></span></code>
:
; php_redis

extension=php_igbinary.dll

extension=php_redis.dll

注意:extension=php_igbinary.dll 一定要放在在 extension=php_redis.dll 的前面,否则扩展失败!!!

5、再次实行步奏1,全文搜索Redis如图:

安装扩展成功,接下来可以简单测试一下!

6、简单测试是否可以启动服务:


<?php   
//连接本地Redis服务

  $redis = new Redis();  
  $link= $redis->connect('127.0.0.1',6379);  
  echo "Connection to server successfully";  
  //查看服务是否运行

 echo "server is running:".$redis->ping();

运行结果如图:

链接成功!

7、存取一下数据

<?php   
//连接本地Redis服务
  $redis = new Redis();  
  $link= $redis->connect('127.0.0.1',6379);  
  //echo "Connection to server successfully";

  //查看服务是否运行

 //echo "server is running:".$redis->ping();

 //选择数据库
 $redis -> select(2);//设置
 key$redis -> set('weather','sun');
 $redis -> set('test','good');var_dump($redis -> get('test'));var_dump($redis -> get('weather'));?>

运行结果如图:

 

8、为了更加直观,我又下载了RedisClient:

打开可视化界面,输入如下信息:

因为没有设置密码所以不用填写。

 

我们刚才是往数据库db2中添加的数据,所以打开查看一下:

<code   style="max-width:90%"><span class="hljs-comment"><span style="font-size: 18px">已经存在数据库中。有了可视化界面,我们可以直接在这里添加数据。<br/><br/>补充:视图中有个语言(</span></span></code><code style="white-space: initial"><span class="hljs-comment"><span style="font-size: 18px"><em style="box-sizing: border-box; font-style: normal; color: rgba(153, 153, 153, 1); font-family: Arial, "Microsoft YaHei", "\\5FAE软雅黑", "\\5B8B体", "Malgun Gothic", Meiryo, sans-serif; font-size: 14px; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; text-indent: 0; text-transform: none; white-space: normal; word-spacing: 0; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 1)"><span class="skip" style="box-sizing: border-box">language</span></em>),可以切换中文和英文!<br/><br/><br/><br/>继续学习探索中...<br/></span><br/></span></code>

language

以上是php7.0怎麼安裝redis擴充的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版

SecLists

SecLists

SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )專業的PHP整合開發工具