使用composer构建PHP框架怎么把Redis引入

如题所述

选择 nrk/predis 作为 Redis 驱动,修改composer.json增加一个 require 项:
"predis/predis": "*"
运行composer update完成安装,新建config/redis.php
<php
return array(
'host' => '127.0.0.1',
'port' => 6379
);
新建 assists/factory.php:
<?php
use Predis\Client;
class Factory{
public static function redis(){
return new Client(require BASE_PATH.'/config/redis.php');
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答