本文整理汇总了PHP中UrlUtil::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlUtil::redirect方法的具体用法?PHP UrlUtil::redirect怎么用?PHP UrlUtil::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UrlUtil
的用法示例。
在下文中一共展示了UrlUtil::redirect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browseResults
public function browseResults ()
{
$this->q = trim ($_GET['q']);
$this->searchType = htmlentities ($_GET['type']);
$this->searchOptions = $this->getSearchOptions ();
if (! empty ($this->cities)) $this->searchOptions->cities = $this->cities;
$this->sort = htmlentities ($_REQUEST['sort']);
$this->setupPerf ();
$this->getSearchResults ();
$this->result = $this->findResult ($this->permalink);
if (! empty ($this->result))
{
$this->setupMeta ();
$this->render ('browseFrame.php');
}
else
{
if ($this->searchOptions->type)
{
UrlUtil::redirect ('/'
. urlencode ($this->searchOptions->type)
. '?q='
. urlencode ($this->searchOptions->q)
. '&e=1', ($_GET['p'] && ! $permaLinkOK));
exit;
}
else
{
$this->render404 ();
}
}
}
示例2: goto
public function goto ()
{
$this->searchType = $_GET['section'];
$this->q = trim ($_GET['q']);
$this->searchOptions = $this->getSearchOptions ();
$this->sort = $_REQUEST['sort'];
$this->setupPerf ();
$this->getSearchResults ();
$numToSkip = 0;
foreach ($this->countByDomain as $k => $v)
{
if ($k == $_GET['city']) break;
$numToSkip += $v;
}
$page = (floor ($numToSkip / self::RESULTS_PER_PAGE)) + 1;
$url = "/{$this->searchType}?q=" . urlencode ($this->q) . "&sort=" . self::SORT_CITY . (($page != 1) ? "&page={$page}" : '' ) ."#{$_GET['city']}";
UrlUtil::redirect ($url);
}