当前位置: 首页>>代码示例>>PHP>>正文


PHP CApp::redirect方法代码示例

本文整理汇总了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("/");
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:10,代码来源:UserController.php

示例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);
 }
开发者ID:ennjamusic,项目名称:study,代码行数:12,代码来源:SiteController.php

示例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("/");
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:24,代码来源:TranslateController.php

示例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");
}
开发者ID:ennjamusic,项目名称:study,代码行数:16,代码来源:index.php

示例5: logout

 public static function logout()
 {
     session_destroy();
     CApp::redirect("/");
 }
开发者ID:ennjamusic,项目名称:study,代码行数:5,代码来源:UserModel.php

示例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");
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:52,代码来源:GmvcController.php


注:本文中的CApp::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。