本文整理汇总了PHP中Load::controller方法的典型用法代码示例。如果您正苦于以下问题:PHP Load::controller方法的具体用法?PHP Load::controller怎么用?PHP Load::controller使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Load
的用法示例。
在下文中一共展示了Load::controller方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseRoute
protected function parseRoute()
{
// parse the route from the URL
if (!empty($this->Uri->uri_parts)) {
$controller = $this->Uri->uri_parts[0];
if (isset($this->Uri->uri_parts[1])) {
$method = $this->Uri->uri_parts[1];
}
}
// use default if no controller has been found
if (empty($controller)) {
$controller = $this->Config->get('default.controller');
}
// use default if no method has been found
if (empty($method)) {
$method = $this->Config->get('default.method');
}
// for controllers with multiple words in their name
$controller = str_replace('-', ' ', $controller);
// convert class name into expected casing
$controller = ucwords($controller);
// remove any spaces to give final controller name
$controller = str_replace(' ', '', $controller);
try {
// init controller
$this->Controller = Load::controller($controller);
} catch (LoadException $e) {
throw new Exception('ROUTER_INVALID_CONTROLLER');
}
// ensure method exists
if (!method_exists($this->Controller, $method)) {
throw new Exception('ROUTER_INVALID_METHOD');
}
// call the method
$this->Method = call_user_func(array($this->Controller, $method));
// call draw method
$this->Draw = call_user_func(array($this->Controller, '_draw'));
}
示例2: bstatus
function bstatus()
{
Load::controller('bstatus');
}
示例3: toCamelCase
exit;
}
}
//если запрошена главная страница админки - выводим ее шаблон
if ($_SERVER['REQUEST_URI'] === '/admin/') {
FileSys::includeFile(ADMIN_ROOT . '/templates/default/index.php');
} else {
$com = Request::get('com');
if (!is_dir(ADMIN_ROOT . '/components/' . $com)) {
Router::set404();
}
if (is_file(ADMIN_ROOT . '/components/' . $com . '/config.php')) {
require_once ADMIN_ROOT . '/components/' . $com . '/config.php';
}
if (is_file(ADMIN_ROOT . '/components/' . $com . '/SectionController.php')) {
Load::controller(ADMIN_ROOT . '/components/' . $com . '/SectionController.php', Request::get('section', false));
} else {
$com_dirs = FileSys::getDirs(ADMIN_ROOT . '/components/' . $com);
$forbidden_dir = ['client'];
$section = Request::get('section');
if (in_array($section, $com_dirs) && !in_array($section, $forbidden_dir)) {
Load::manager(ADMIN_ROOT . '/components/' . $com . '/' . $section . '/' . toCamelCase($section) . 'Manager.php');
} else {
Router::set404();
}
}
}
} catch (SystemException $e) {
header('HTTP/1.0 500 Internal Server Error');
echo $e->getError();
} catch (ValidatorException $e) {
示例4: helpers
public function helpers()
{
Load::controller(__DIR__ . '/helpers/HelpersController.php', Request::get('action'));
}
示例5: manager
public static function manager($path)
{
Load::controller($path, Request::get('action', false));
}