本文整理汇总了PHP中Routes::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Routes::getParams方法的具体用法?PHP Routes::getParams怎么用?PHP Routes::getParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Routes
的用法示例。
在下文中一共展示了Routes::getParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
public static function dispatch($url, $controller, $action)
{
if (Settings::getItem('fancyurl') == true) {
$a_params = Routes::getParams($url);
if ($a_params !== false) {
foreach ($a_params as $param => $value) {
$_GET[$param] = $value;
}
}
}
$controller_dispatch = new $controller();
$return = $controller_dispatch->{$action}();
if (isset($_GET["json"]) and $_GET["json"] == 1) {
die(json_encode(utf8_encode($return)));
} elseif (isset($_GET["ajax"]) and $_GET["ajax"] == 1) {
die(utf8_encode($return));
}
}
示例2: initiateController
public function initiateController()
{
if ($_SERVER['SCRIPT_FILENAME'] == './scripts/db.php') {
return false;
}
$route = new Routes($this->uriSegment('whole'));
$controller_class = $route->getController() . '_controller';
$action = $route->getAction();
if (class_exists($controller_class) && !empty($action)) {
$controller = new $controller_class();
$controller->setParams($route->getParams($controller));
$controller->setRequest($route->getRequest());
$controller->{$action}();
} else {
echo 'contorller: ' . $controller_class . ' action: ' . $action . '<br/>';
die("404 - dont know what you're looking for");
}
}