init commit
This commit is contained in:
28
app/Bootstrap.php
Normal file
28
app/Bootstrap.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user