http://docs.phalconphp.com/en/0.6.0/reference/di.html
在public/index.php中,codeing:
$di->set('viewCache', function(){
//Cache data for one day by default
$frontCache = new Phalcon\Cache\Frontend\Output(array(
"lifetime" => 86400
));
//Memcached connection settings
$cache = new Phalcon\Cache\Backend\File($frontCache, array(
"cacheDir" => "../apps/caches/"
));
return $cache;
});在控制器中,我可以使用这个->视图->缓存(),为什么viewCache不能在服务命名约定中使用呢?
发布于 2012-11-06 21:42:09
可以像这样访问服务viewCache:
// In controller
$this->view->cache();或
// In controller
$this->di->get('viewCache');或
// In a module or other file
$di = \Phalcon\DI::getDefault();
$di->get('viewCache');https://stackoverflow.com/questions/13244087
复制相似问题