本文整理汇总了PHP中Router::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::getUrl方法的具体用法?PHP Router::getUrl怎么用?PHP Router::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Router
的用法示例。
在下文中一共展示了Router::getUrl方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct this object by extending the base Controller class
*/
public function __construct()
{
parent::__construct();
// get project url
$this->data['project_url'] = Router::getProjectUrl();
$this->data['current_url'] = Router::getUrl();
}
示例2: index
public function index($search)
{
$result = Result::convert(parent::index($search));
$result->addData(array('operation_link_list' => array(function (User $item) {
return '<a href="' . Router::getUrl('user/updatePassword', array('id' => $item->id)) . '" rel="popup">修改密码</a>';
})));
return $result;
}
示例3: initialize
/**
* Calls authorize and prepare in this order.
* The ControllerFactory calls initialize when creating a controller, if $skipInitialization == false
*
* If you skip it, make sure you call all methods yourself!
*
*
* @see authorize()
* @see prepare()
* @see ErrorMessageException
*/
public final function initialize()
{
$this->router->setCurrentRoute($this->getUrlName(), $this->getUrlAction(), $this->getActionParameters());
if (($error = $this->router->getUrlError()) !== null) {
$this->addError($error);
}
if (($success = $this->router->getUrlSuccess()) !== null) {
$this->addSuccess($success);
}
try {
$this->authorize();
$this->prepare();
} catch (DatabaseException $e) {
Log::error($e->getMessage(), 'Controller', array('siteName' => $this->getSiteName()));
throw new ControllerException('Database error.');
}
if ($this->keepInHistory()) {
$this->container->history->addUrl($this->router->getUrl());
}
}
示例4: arenaController
include_once 'controller/arenaController.php';
$arenaController = new arenaController();
if ($action != '') {
handleFullUrl($arenaController, $action);
} else {
$arenaController->arenaAction();
}
break;
case 'character':
include_once 'controller/characterController.php';
$characterController = new CharacterController();
handleFullUrl($characterController, $action);
break;
}
} else {
$loginUrl = Router::getUrl('user_login');
redirectTo($loginUrl);
}
}
function redirectTo($url)
{
//if(!strpos($url, 'http://'))
// $url = 'http://' . $url;
header('Location:' . $url);
}
//Automatically choose controller and action basing on url
function handleFullUrl($controller, $action)
{
$fullActionName = $action . 'Action';
if (method_exists($controller, $fullActionName)) {
$controller->{$fullActionName}();
示例5: render
public static function render($code, $params)
{
header("HTTP/1.0 503 Service Unavailable");
switch ($code) {
case 1:
if (!Kernel::getDebugMode()) {
self::redirect(Router::getUrl("error", "http", array(404)));
}
$message = "Controller not found";
$origin = "class";
break;
case 2:
if (!Kernel::getDebugMode()) {
self::redirect(Router::getUrl("error", "http", array(404)));
}
$message = "Action not found";
$origin = "function";
break;
case 3:
if (!Kernel::getDebugMode()) {
self::redirect(Router::getUrl("error", "http", array(404)));
}
$message = "Theme not found";
$origin = "theme :";
break;
case 4:
if (!Kernel::getDebugMode()) {
self::redirect(Router::getUrl("error", "http", array(404)));
}
$message = "Number of required parameters for action has not been reached";
$origin = "function :";
break;
case 5:
if (!Kernel::getDebugMode()) {
self::redirect(Router::getUrl("error", "http", array(404)));
}
$message = "Database connection failed";
$origin = "Message :";
break;
default:
if (!Kernel::getDebugMode()) {
self::redirect(Router::getUrl("error", "http", array(404)));
}
$message = "Fatal Error catched !";
$origin = "Message :";
break;
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?php
echo $message;
?>
</title>
</head>
<body>
<div style="font-family: 'lucida grande',tahoma,verdana,arial,sans-serif;padding: 30px;border: 1px solid #E5E5E5;background: #F9F9F9;width: 400px;margin: auto;margin-top: 40px;border-radius: 5px;">
<span style="font-size: 1.2em;font-weight: bold;"><?php
echo $message;
?>
</span>
<pre style="margin-bottom: 0px;white-space : pre-wrap;"><span style="color: grey;"><?php
echo $origin;
?>
</span> <?php
echo $params;
?>
</pre>
</div>
</body>
</html>
<?php
die;
}
示例6: array
<a href="<?php
echo Router::getUrl("content", "list", array("type" => "comment"));
?>
">
<div class="menu-onglet<?php
if ($header == "comment") {
?>
-active<?php
}
?>
">
Comments
</div>
</a>
<a href="<?php
echo Router::getUrl("parameters", "index");
?>
">
<div class="menu-onglet<?php
if ($header == "parameters") {
?>
-active<?php
}
?>
">
Paramêtres
</div>
</a>
</div>
</div>
<?php
示例7: generateUrl
public function generateUrl($route, $parameters = null)
{
return Router::getUrl($route, $parameters);
}
示例8: testGetUrlWrongNumberOfArgumentsForNamedRoutes
/**
* @expectedException InvalidArgumentException
*/
public function testGetUrlWrongNumberOfArgumentsForNamedRoutes()
{
$router = new Router();
$route = new MockRoute_GetLink();
$router->addRoute('myroute', $route);
$failed_url = $router->getUrl('myroute', array(':class' => 'myclass', ':method' => 'mymethod'));
}
示例9: DisconnectAction
public function DisconnectAction($params)
{
$this->Auth->disconnect();
$this->redirect(Router::getUrl("/"));
}
示例10: bootstrap
public function bootstrap()
{
// set urls
$this->data['project_url'] = Router::getProjectUrl();
$this->data['current_url'] = Router::getUrl();
// set date format
$this->data['date_format'] = App::load()->date_format;
// set default includes
$this->header = PATH_APP_VIEWS . 'admin/default/assets/inc/_header';
$this->sidebar = PATH_APP_VIEWS . 'admin/default/assets/inc/_sidebar';
$this->footer = PATH_APP_VIEWS . 'admin/default/assets/inc/_footer';
}
示例11:
var urlDeleteNode = '<?php
echo Router::getUrl("content", "deletenodeajax");
?>
';
var urlUpdate = '<?php
echo Router::getUrl("content", "updateajax");
?>
';
var urlRemove = '<?php
echo Router::getUrl("content", "removeajax");
?>
';
var urlRestore = '<?php
echo Router::getUrl("content", "restoreajax");
?>
';
var urlAddChooseBundle= '<?php
echo Router::getUrl("content", "addchoosebundleajax");
?>
';
var urlAddForm = '<?php
echo Router::getUrl("content", "addformajax");
?>
';
var urlAddSave = '<?php
echo Router::getUrl("content", "addsaveajax");
?>
';
</script>