| 1234567891011121314151617181920212223242526 | <?php// +----------------------------------------------------------------------// | ThinkPHP [ WE CAN DO IT JUST THINK ]// +----------------------------------------------------------------------// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.// +----------------------------------------------------------------------// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )// +----------------------------------------------------------------------// | Author: 流年 <liu21st@gmail.com>// +----------------------------------------------------------------------// 应用公共文件function newredis(){    $redis = new Redis();    $redisconfig = config("redis");    $redis->connect($redisconfig["host"], $redisconfig["port"]);    if ($redisconfig['redis_pwd']) {        $redis->auth($redisconfig['redis_pwd']);    }    if($redisconfig['redis_selectdb'] > 0){        $redis->select($redisconfig['redis_selectdb']);    }    return $redis;}
 |