方式一、需要生產(開發)環境安裝php得c擴充套件

案例:

1
2
3
4
5
6
7
8
9
<?php                                                                                                                                     
   
     $redis=new Redis();
     $redis->connect(`192.168.1.96`,`6379`);
     $redis->select(1);
  
     $key=`wait_bill`;
    $result=$redis->hGetAll($key);
 ?>


方式二、源生php語言寫的驅動包

1
2
3
4
5
6
7
8
9
<?php
require_once(`./predis/autoload.php`);
 
$redis       new PredisClient([`host`=>`192.168.1.96`,`port`=>6379,`database`=>1,`password`=>null]);
 
 
$result=$redis->keys(`*`);
print_r($result);
?>


附:predis驅動程式

https://packagist.org/packages/predis/predis