本文整理汇总了PHP中router::getController方法的典型用法代码示例。如果您正苦于以下问题:PHP router::getController方法的具体用法?PHP router::getController怎么用?PHP router::getController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类router
的用法示例。
在下文中一共展示了router::getController方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->setRequestParams();
$rout = new router($this->contData);
$contName = $rout->getController();
$this->cont = new $contName();
$this->cont->init($this->contData);
}
示例2: startController
private function startController()
{
$router = new router();
$controller = "controllers\\" . $router->getController();
$this->controller = $controller;
$this->controllerstring = "controllers_" . $router->getController();
$obj = new $controller();
$method = $router->getAction();
$this->action = $method;
try {
$obj->{$method}();
$this->view = $obj;
if (!empty($obj->view)) {
$this->viewfile = $obj->view;
} else {
$this->viewfile = $method;
}
} catch (\Exception $e) {
$this->render = '<p class="errorMessage">' . $e->getMessage() . '</p>';
}
}
示例3: isAuth
function isAuth()
{
$db = sf::getLib("db");
$result = $db->fetch_first("SELECT * FROM " . $this->table . " WHERE `controller` = '" . router::getController() . "' AND method = '" . router::getMethod() . "'");
if ($result) {
if (sf::getPlugin("authentic")->isLogin($result['user_group_ids'])) {
return true;
} else {
return false;
}
} else {
$this->setController(router::getController());
$this->setControllerName(router::getController());
$this->setMethod(router::getMethod());
$this->setUserGroupIds("1");
$this->save();
return false;
}
}
示例4: sfException
require_once SYSTEMPATH . 'sf/language.class.php';
require_once SYSTEMPATH . 'sf/input.class.php';
//加载配置文件
config::load('default');
//加载必要库文件
loader::lib(array("controller", "model"));
//加载默认helper
loader::helper(config::get("auto_load_helper", 'url'));
//加载默认插件
config::get("auto_load_plugin") && loader::plugin(config::get("auto_load_plugin"));
//初始化pathinfo
router::parse();
//加载语言文件
lang::setLang(config::get("default_lang", "chinese"));
lang::load("global");
//执行控制器
$controller = sf::getController(router::getController());
try {
method_exists($controller, "load") && $controller->load();
//存在LOAD方法执行LOAD方法(页面执行开始执行)
if (!method_exists($controller, router::getMethod())) {
throw new sfException(sprintf(lang::get("Call to undefined method %s::%s"), get_class($controller), router::getMethod()));
}
$controller->{router::getMethod()}();
method_exists($controller, "shutdown") && $controller->shutdown();
//存在SHUTDOWN方法执行他(页面执行完成执行)
} catch (tfException $e) {
method_exists($controller, "shutdown") && $controller->shutdown();
//发生意外执行shutdown方法
$e->halt();
}
示例5: strrpos
<?php
/*
* bootstrap file containing some basic configuration and loading
*/
define('_BASEPATH_', __DIR__ . '/');
define('_LIBS_', _BASEPATH_ . 'libs/');
define('_TMP_', _BASEPATH_ . 'tmp/');
define('_CONTROLLERS_', _BASEPATH_ . 'controllers/');
// get base URL, without subdir if exists
$base = $_SERVER['PHP_SELF'];
$idx = strrpos($base, '/');
define('_BASEURL_', substr($_SERVER['PHP_SELF'], 0, $idx));
// get URI without base path
$idx = strpos($_SERVER['REQUEST_URI'], _BASEURL_) + strlen(_BASEURL_);
$uri = substr($_SERVER['REQUEST_URI'], $idx);
unset($base, $idx);
$refreshAutoloaderCache = true;
require_once _LIBS_ . 'autoloader.php';
autoloader::init($refreshAutoloaderCache);
$router = new router($uri);
// load the controller
$controller = $router->getController();
$controller = new $controller();
$method = $router->getMethod();