/** * 初始化环境,返回action层对应类的实例 * @return class 触发到的action层对应类 */ public function init() { Vera_Autoload::init(); $router = new Vera_Router(); if (!Vera_Router::isApp()) { //如果app未开启,停止运行 exit; } set_exception_handler('Action_Error::run'); //最高级的异常捕获,统一显示为每个app自定的错误 self::$Log = new Vera_Log(); self::$Log->init(); if (Vera_Autoload::isExists('Action_Auth')) { if (!Action_Auth::run()) { Vera_Log::addNotice('auth', 'fail'); exit; } Vera_Log::addNotice('auth', 'success'); } return $router->getAction(); }
<?php /** * * @copyright Copyright (c) 2014 Yuri Zhang (http://www.yurilab.com) * All rights reserved * * file: index.php * description: Vera 入口 * * @author Yuri * @license Apache v2 License * **/ header("Content-type: text/html; charset=utf-8"); include 'tools/Bootstrap.php'; error_reporting(0); ini_set('display_errors', true); $class = new Vera_Bootstrap(); $class->init()->run();