phalcon: 开启模板缓存和缓存路径

 /**
         * 设置view
         */
        $di->set('view', function () use ($config) {
            $view = new \Phalcon\Mvc\View();
            $view->setViewsDir(BASE_PATH . $config->home_application->viewsDir);
            $view->registerEngines(array(
                '.phtml' => function($view, $di) use ($config) {
                    $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
                    $volt -> setOptions(array(
                        'compileAlways' => true,
                        'compiledPath'  =>  BASE_PATH . $config->home_application->compileDir,
                    ));
                    return $volt;
                },
            ));
            return $view;
        });

  

posted @ 2017-05-23 14:47  穆晟铭  阅读(1191)  评论(0编辑  收藏  举报