TP5使用redis

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;
        

        } 



猜你喜欢

转载自blog.csdn.net/qq_34886247/article/details/81036640