How to install redis in thinkphp
Although there is S function
but how to install it
How to install redis in thinkphp
Although there is S function
but how to install it
ThinkPHP has a redis class, so you don’t need to write another one.
1, install redis and start redis-server
2, install phpredis extension, https://github.com/phpredis/phpredis
3, set the cache type in the tp configuration file to DATA_CACHE_TYPE => ; 'Redis'
There are several parameter items
<code>$options = array_merge(array( 'host' => C('REDIS_HOST') ?: '127.0.0.1', 'port' => C('REDIS_PORT') ?: 6379, 'password' => C('REDIS_PASSWORD') ?: '', 'timeout' => C('DATA_CACHE_TIMEOUT') ?: false, 'persistent' => false, ), $options);</code>
It should be said that PHP loads the redis extension, and then you can operate redis in the corresponding controller file
php
and redis
have nothing to do with each other
I don’t know what the question meansthinkphp
How to use redis
? There must be a corresponding class library
a c extension https://github.com/phpredis/phpredis