方式一、需要生产(开发)环境安装php得c扩展
案例:
<?php $redis=new Redis(); $redis->connect(‘192.168.1.96‘,‘6379‘); $redis->select(1); $key=‘wait_bill‘; $result=$redis->hGetAll($key); ?>
方式二、源生php语言写的驱动包
<?php require_once(‘./predis/autoload.php‘); $redis = new Predis\Client([‘host‘=>‘192.168.1.96‘,‘port‘=>6379,‘database‘=>1,‘password‘=>null]); $result=$redis->keys(‘*‘); print_r($result); ?>
附:predis驱动程序
https://packagist.org/packages/predis/predis
时间: 2024-12-21 17:06:20