当前位置: 代码迷 >> 综合 >> TP5使用redis
  详细解决方案

TP5使用redis

热度:23   发布时间:2023-10-18 05:50:51.0

use think\Cache;

//redis对象
        public function getRedis()
        {
         $options = [


        'type'  => 'redis',//指定类型


        'password'=>'asdfghjkl',
    
        'prefix' => 'sbn-',


        'host'   => '127.0.0.1',


                ];
                
        $redis = Cache::init($options);     
        return $redis;
        

        }