本文整理匯總了PHP中Main::redirect方法的典型用法代碼示例。如果您正苦於以下問題:PHP Main::redirect方法的具體用法?PHP Main::redirect怎麽用?PHP Main::redirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Main
的用法示例。
在下文中一共展示了Main::redirect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: time
<?php
namespace Application;
include_once "../../vendor/autoload.php";
$action = $_GET['action'];
$url = $_GET['url'];
$is_limited = $_GET['limit_link'] == 'false' ? false : true;
$custom_link = $_GET['custom_link'];
session_start();
if (!isset($_SESSION['server_time'])) {
$_SESSION['server_time'] = time();
}
$main = new Main();
$main->checkElapsedTime();
switch ($action) {
case 'redirect':
$main->redirect($url);
break;
case 'minimize':
$main->minimize($url, $is_limited);
break;
case 'minimizeCustomUrl':
$main->minimizeCustomUrl($url, $is_limited, $custom_link);
break;
case 'getStatistic':
$main->getStatistic();
break;
}
示例2: isset
$currentPage = isset($_REQUEST['action']) ? $_GET['action'] : 'index';
$currentTemplate = '/pages/' . $currentPage;
$isPost = $_SERVER['REQUEST_METHOD'] == 'POST' ? true : false;
$componentId = $elementId = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$componentName = isset($_GET['componentname']) ? trim($_GET['componentname']) : '';
switch ($currentPage) {
case 'componentslist':
case 'index':
Arr::set($arResult, 'componentsList', $main->getComponentsList($curPageNum, Config::get('module.perPage')));
break;
case 'showcomponent':
if ($componentId > 0) {
$arComponent = $main->db->getRow('SELECT * FROM ?n WHERE id = ?i', PREFIX . '_components', $componentId);
if (!$arComponent) {
// Делаем редирект с сообщенем об ошибочной выборке
$main->redirect(Arr::get($arResult, 'home') . '&action=componentslist', 'error', 'Компонент с кодом <b>' . $componentId . '</b> не найден');
}
Arr::set($arResult, 'component', $arComponent);
$componentList = $main->getComponentElements($arComponent['name'], $curPageNum, Config::get('module.perPage'));
Arr::set($arResult, 'componentList', $componentList);
} else {
// Делаем редирект с сообщенем об ошибочной выборке
$main->redirect(Arr::get($arResult, 'home') . '&action=componentslist', 'error', 'Не задан ID компонента');
}
break;
case 'showelement':
if ($componentName != '' && $elementId > 0) {
$arElement = $main->getElementById($componentName, $elementId);
if (!$arElement['id']) {
$main->redirect(Arr::get($arResult, 'home') . '&action=componentslist', 'error', 'Элемент с кодом <b>' . $elementId . '</b> не найден');
}
示例3: setCurrentLang
public static function setCurrentLang($lang)
{
\Session::set('current_admin_form_locale', $lang);
self::$currentLocal = $lang;
return Main::redirect('');
}