本文整理汇总了PHP中Framework::controller方法的典型用法代码示例。如果您正苦于以下问题:PHP Framework::controller方法的具体用法?PHP Framework::controller怎么用?PHP Framework::controller使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework
的用法示例。
在下文中一共展示了Framework::controller方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
function dispatch()
{
require_once 'framework.php';
try {
session_start();
Framework::boot();
Framework::$controller = new Controller();
Framework::$controller->process_route();
} catch (Exception $e) {
Framework::$controller->process_exception($e);
}
}
示例2: run
/**
* 执行程序入口
*
* @param $page array 默认设置,里面传入两个选项 一个 $platform,一个controller,用来控制平台和控制器,默认front
*/
public static function run($page = array())
{
self::$platform = self::getNullReplace($page['platform'], 'front');
self::$controller = self::getNullReplace($page['controller'], 'front');
/**
* 注册自动加载方法
*/
spl_autoload_register(array('Framework', 'autoLoad'));
self::loadSafeSql();
self::initRequest();
self::initPath();
self::loadConfig();
self::initTimezone();
self::initErrorHandler();
self::dispatch();
}
示例3: start
/**
* Start up the framework
*
* @access public
* @param string $site The site to load
* @param string $controller Which controller to use
* @return boolean True on success
* @throws Framework_Exception
*/
public static function start($site = 'Default', $controller = 'Web')
{
self::$site = Framework_Site::factory($site);
if (is_null(Framework::$log)) {
$logFile = (string) Framework::$site->config->logFile;
Framework::$log = Log::factory('file', $logFile);
}
self::$site->prepare();
self::$controller = Framework_Controller::factory($controller);
self::$request = Framework_Request::factory(self::$controller->requester);
self::$module =& self::$controller->module();
if (!in_array($controller, self::$module->controllers)) {
throw new Framework_Exception('Invalid controller requested', FRAMEWORK_MODULE_ERROR_INVALID_CONTROLLER);
}
self::$controller->authenticate();
$result = self::$controller->start();
return self::$controller->display();
}
示例4: start
/**
* start
*
* @access public
* @return mixed PEAR_Error on failure, true on success
*/
public static function start($site = 'Default', $controller = 'Web')
{
self::$site = Framework_Site::factory($site);
if (PEAR::isError(self::$site)) {
return PEAR::raiseError(self::$site->getMessage(), FRAMEWORK_ERROR_SITE);
}
if (is_null(Framework::$log)) {
$logFile = (string) Framework::$site->config->logFile;
Framework::$log = Log::factory('file', $logFile);
}
$result = self::$site->prepare();
if (PEAR::isError($result)) {
return PEAR::raiseError($result->getMessage(), FRAMEWORK_ERROR_SITE);
}
self::$controller = Framework_Controller::factory($controller);
if (PEAR::isError(self::$controller)) {
return self::$controller;
}
try {
self::$request = Framework_Request::factory(self::$controller->requester);
} catch (Framework_Exception $error) {
return PEAR::raiseError($error->getMessage(), FRAMEWORK_ERROR_REQUEST);
}
self::$module =& self::$controller->module();
if (PEAR::isError(self::$module)) {
return PEAR::raiseError(self::$module->getMessage(), FRAMEWORK_ERROR_MODULE_INIT);
}
if (!in_array($controller, self::$module->controllers)) {
return PEAR::raiseError('Invalid controller requested', FRAMEWORK_MODULE_ERROR_INVALID_CONTROLLER);
}
$result = self::$controller->authenticate();
if (PEAR::isError($result)) {
return PEAR::raiseError($result->getMessage(), FRAMEWORK_ERROR_AUTH);
}
$result = self::$controller->start();
if (PEAR::isError($result)) {
return PEAR::raiseError($result->getMessage(), FRAMEWORK_ERROR_MODULE_EVENT);
}
return self::$controller->display();
}