1
0
Files
yafcms/app/Bootstrap.php
2021-07-21 09:48:17 +08:00

29 lines
842 B
PHP

<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
public function _initLoad()
{
Yaf_Loader::import(APP_PATH . '/vendor/autoload.php');
}
public function _initConfig(Yaf_Dispatcher $dispatcher) {
// 把配置保存起来
Yaf_Registry::set('config', Yaf_Application::app()->getConfig());
if (Yaf_Application::app()->environ() !== 'product') {
error_reporting(E_ALL & ~ E_NOTICE);
ini_set('display_errors', 1);
}
}
public function _initView(Yaf_Dispatcher $dispatcher) {
// 禁用yaf自带的模板引擎
Yaf_Dispatcher::getInstance()->disableView();
//设置smarty
$smarty = new Smarty_Adapter(null , Yaf_Application::app()->getConfig()->smarty);
return Yaf_Dispatcher::getInstance()->setView($smarty);
}
}