本文整理汇总了PHP中CApp::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP CApp::redirect方法的具体用法?PHP CApp::redirect怎么用?PHP CApp::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApp
的用法示例。
在下文中一共展示了CApp::redirect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAction
public function deleteAction($id)
{
if ($_SESSION["userRole"] == CApp::settings("USER_ROLES")->ADMIN && $_GET["view"] == "delete" && !empty($_GET["id"])) {
$model = new UserModel();
$model->deleteById($id);
CApp::redirect(CApp::getLink(array("controller" => "user", "view" => "index")));
} else {
CApp::redirect("/");
}
}
示例2: cacheClearAction
public function cacheClearAction()
{
$dirname = $_SERVER["DOCUMENT_ROOT"] . "/cache/";
$dir = opendir($dirname);
while (($file = readdir($dir)) !== false) {
if (is_file($dirname . "/" . $file)) {
unlink($dirname . "/" . $file);
}
}
$path = CApp::getLink(array("controller" => "site", "view" => "settings"));
CApp::redirect($path);
}
示例3: indexAction
public function indexAction()
{
if ($_SESSION["userRole"] == USER_ROLE_ADMIN) {
CApp::setTitle(CApp::getAppName() . " | " . CApp::getTranslate('translateApp'));
$arrResult = CApp::getTranslateAll();
if (!empty($_POST["TRANSLATE"])) {
$translateArray = array();
foreach ($_POST["TRANSLATE"] as $key => $value) {
if ($key == "newVal" && empty($value[0]) && empty($value[1])) {
continue;
}
if (empty($value[0]) && empty($value[1])) {
continue;
}
$translateArray[filterGetValue($value[0])] = filterGetValue($value[1]);
}
$model = new TranslateModel();
$arrResult = $model->update($translateArray, $arrResult);
}
$this->render("changeTranslate", "translate", $arrResult);
} else {
CApp::redirect("/");
}
}
示例4: CGmvcController
<?php
include $_SERVER["DOCUMENT_ROOT"] . "/engine/protected/prolog.php";
if (GMVC_ON) {
$controller = new CGmvcController();
if (!isset($_GET["view"])) {
$controller->indexAction();
} else {
$view = filterGetValue($_GET["view"]);
$command = new CCommand();
$action = $command->createAction($view);
$controller->{$action}();
}
} else {
CApp::redirect("/errors/404.php");
}
示例5: logout
public static function logout()
{
session_destroy();
CApp::redirect("/");
}
示例6: createTableAction
public function createTableAction()
{
if ($_SESSION["GMVC_AUTH"] == "Y") {
if ($_POST["save"] == "Save") {
$model = new GmvcModel();
$tableName = filterGetValue($_POST["tableName"]);
$tableArr = array();
foreach ($_POST["FIELDS"] as $fieldArr) {
$newFieldArr = array();
foreach ($fieldArr as $key => $val) {
if ($key == "fieldName") {
continue;
}
if (!empty($val)) {
switch ($key) {
case "fieldType":
$newFieldArr["type"] = filterGetValue($val);
break;
case "lengthType":
$newFieldArr["length"] = filterGetValue($val);
break;
case "keyType":
$newFieldArr["key"] = filterGetValue($val);
break;
case "defaultVal":
$newFieldArr["default"] = filterGetValue($val);
break;
case "indexVal":
$newFieldArr["index"] = filterGetValue($val);
break;
case "ifNull":
$newFieldArr["not_null"] = $val ? true : false;
break;
case "ifAI":
$newFieldArr["auto_increment"] = $val ? true : false;
break;
default:
break;
}
}
}
$tableArr[filterGetValue($fieldArr["fieldName"])] = $newFieldArr;
}
if (!empty($tableArr)) {
$model->createTable($tableName, $tableArr);
}
}
$this->render("createTable");
} else {
CApp::redirect("index");
}
}