本文整理汇总了PHP中Nette\Application\UI\Control::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Control::redirect方法的具体用法?PHP Control::redirect怎么用?PHP Control::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Control
的用法示例。
在下文中一共展示了Control::redirect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
/**
* Redirect to another presenter, action or signal.
* @param int [optional] HTTP error code
* @param string destination in format "[[module:]presenter:]view" or "signal!"
* @param array|mixed
* @return void
* @throws Nette\Application\AbortException
* @throws Nette\InvalidStateException
*/
public function redirect($code, $destination = NULL, $args = array())
{
if (!$this->actionHandled && $this->renderCalled) {
throw new Nette\InvalidStateException("You cannot use redirect when no signal is called. Use " . get_called_class() . "::changeView() instead.");
}
// Pokud redirectujeme na Nette lazy link, nesmime pouzit jeho serializaci,
// protoze generuje URL pomoci Presenter::createRequest v LINK modu.
// To neprenasi flash session ID. Zpravicky ale potrebujeme zachovavat.
// Proto musime vygenerovat pozadavek znovu
if (func_num_args() == 1 && $code instanceof Nette\Application\UI\Link) {
$link = $code;
// Potrebujeme znat komponentu
if (!$link instanceof vBuilder\Application\UI\Link) {
throw new \LogicException("Perhaps wanted to pass vBuilder\\Application\\UI\\Link instead of Nette one?");
}
$link->component->redirect($link->destination, $link->getParameters());
return;
} else {
if (func_num_args() < 3) {
$args = $destination;
$destination = $code;
$code = NULL;
}
}
if ($destination == 'this') {
$destination = $this->view;
}
if ($code) {
parent::redirect($code, $destination, $args);
} else {
parent::redirect($destination, $args);
}
}