Heim >Backend-Entwicklung >PHP-Tutorial >thinkphp如何安装redis

thinkphp如何安装redis

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-06 13:53:061864Durchsuche

thinkphp如何安装redis
虽然有S函数
但是如何安装

回复内容:

thinkphp如何安装redis
虽然有S函数
但是如何安装

ThinkPHP是有redis类的,不需要你再写一个了。

1, 安装redis,并启动redis-server
2, 安装phpredis扩展,https://github.com/phpredis/phpredis
3, 在tp配置文件中设置缓存类型为 DATA_CACHE_TYPE => 'Redis'

有几个参数项

<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>

应该说是php加载redis扩展吧,然后你再对应的控制器文件操作redis就好了

phpredis 完全没有关系
不清楚问题是什么意思
thinkphp 如何 使用 redis?肯定有相应的类库的
一个 c 扩展 https://github.com/phpredis/phpredis

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn