首页 >后端开发 >php教程 >在zend Framework项目中使用Redis缓存PHP的数组

在zend Framework项目中使用Redis缓存PHP的数组

WBOY
WBOY原创
2016-07-25 09:10:251242浏览
  1. $config = Zend_Registry::get('config');
  2. $host = $config->setting->redis->host;
  3. $port = $config->setting->redis->port;
  4. $redis = new Redis();
  5. $redis->connect($host, $port) or die("connect to redis error\n");
  6. $redis->auth($config->setting->redis->password) or die("auth failed\n");
  7. $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
复制代码


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn