コード例 #1
0
	/**
	 * 验证通过后运行数据层
	 */
	protected static function _run()
	{
		$actionName = SuiShiPHPConfig::getAction();
		$method = SuiShiPHPConfig::getMethod();

		define("__ACTION_NAME__", $actionName);
		define("__ACTION_METHOD__", $method);
		define("__APP_GROUP__", SuiShiPHPConfig::getAppGroup());

		if (SuiShiPHPConfig::getAppGroup()) {
			$actionName = SuiShiPHPConfig::getAppGroup() . '.' . $actionName;
		}
		$action = loadAction($actionName);
		
		if (! $action || ! method_exists($action, $method)) {
			if (SuiShiPHPConfig::get('DEBUGGING') === true) {
				Logger::error('_run error: action not exist, action: '.__ACTION_NAME__.', method: '.__ACTION_METHOD__,
				HttpRequest::get());
				throw new Exception('action not exist, action: '.__ACTION_NAME__.', method: '.__ACTION_METHOD__);
			} else {
				Logger::error('_run error: action not exist, action: '.__ACTION_NAME__.', method: '.__ACTION_METHOD__,
				HttpRequest::get());
				myExit(); //TODO () 转向到404 页面
			}
		}
		
		$action->$method(HttpRequest::get());
	}