本文整理汇总了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('');
}