1
0

init commit

This commit is contained in:
2021-05-13 11:35:49 +08:00
commit a2db70af8b
18 changed files with 541 additions and 0 deletions

28
app/Bootstrap.php Normal file
View 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);
}
}