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


PHP Error::httpError方法代码示例

本文整理汇总了PHP中Error::httpError方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::httpError方法的具体用法?PHP Error::httpError怎么用?PHP Error::httpError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error::httpError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: navigate

 public function navigate()
 {
     $url = trim($_SERVER['REQUEST_URI'], "/");
     $result = $this->findUrl($url);
     $urlParts = explode("/", $url);
     $args = array();
     if ($result) {
         // Если URL записан.
         $parts = explode("/", $result);
     } else {
         $parts = $urlParts;
     }
     $controller = ucfirst(array_shift($parts)) . "Controller";
     if (!class_exists($controller)) {
         Error::httpError(404);
     }
     $controller = new $controller();
     $action = "action" . ucfirst(array_shift($parts));
     if (!method_exists($controller, $action)) {
         Error::httpError(404);
     }
     if (method_exists($controller, "access")) {
         $controller->access();
     }
     for ($i = 0; $i < count($parts); $i++) {
         $args[] = array_pop($urlParts);
     }
     call_user_func_array(array(new $controller(), $action), $args);
     exit;
 }
开发者ID:bionicle12,项目名称:testsite,代码行数:30,代码来源:Router.php

示例2: access

 public function access()
 {
     if (!Auth::isLogged()) {
         $this->redirect("/login");
     }
     if (!Auth::isAdmin()) {
         Error::httpError(403);
     }
 }
开发者ID:bionicle12,项目名称:testsite,代码行数:9,代码来源:AdminController.php

示例3: actionIndex

 public function actionIndex($seo)
 {
     $cat = CatsModel::model()->where("`seo_url`='{$seo}'")->findRow();
     if (!$cat) {
         Error::httpError(404);
     }
     $movies = MoviesModel::model()->where("`cat_id`='{$cat->id}'")->findAll();
     $this->view("category/list", array("movies" => $movies, "cat" => $cat), false);
 }
开发者ID:bionicle12,项目名称:testsite,代码行数:9,代码来源:CategoryController.php

示例4: haveGlobal

        $_SESSION['error_' . $name] = $text;
    }
    /*
     * Проверяем, есть ли в сессии глобальная ошибка.
     */
    public static function haveGlobal($name)
    {
        return isset($_SESSION['error_' . $name]);
    }
    /*
     * Получаем глобальную ошибку и стираем её.
     */
    public static function showGlobal($name)
    {
        $error = isset($_SESSION['error_' . $name]) ? $_SESSION['error_' . $name] : false;
        unset($_SESSION['error_' . $name]);
        return $error;
    }
    /*
     * Отображаем страницу ошибки.
     */
    public static function httpError($name, $isShow = true)
    {
        if ($isShow === true) {
            include "views/errors/" . $name . ".php";
            exit;
        }
    }
}
Error::httpError("error", false);
开发者ID:bionicle12,项目名称:testsite,代码行数:30,代码来源:Error.php

示例5: actionActivate

 public function actionActivate($hash)
 {
     $model = UsersModel::model()->where("`hash`='{$hash}'")->findRow();
     if (!$model || $model->status != 0) {
         Error::httpError(404);
     }
     $model->status = 1;
     $model->save();
     $this->view("user_registered", array("message" => Lang::get("account_activated")), false);
 }
开发者ID:bionicle12,项目名称:testsite,代码行数:10,代码来源:DefaultController.php

示例6: actionShowSerial

 public function actionShowSerial($seoUrl)
 {
     if ($_SESSION['user']['id'] != "") {
         $movie = MoviesModel::model()->where("`seo_url` = '{$seoUrl}'")->findRow();
         $seasons = SeasonModel::model()->where("`serial_id` = '{$movie->id}'")->order("sort asc")->findAll();
         $rating = RatingsModel::getRating($movie->id);
         $rating_count = RatingsModel::getRatingCount($movie->id);
         $user = UsersModel::model()->where(" `id` = '{$_SESSION['user']['id']}' ")->findRow();
         $user_major = UsersModel::isPackageActive();
         switch ($movie->in_roles) {
             case 1:
                 $difficulty = "Легкий";
                 break;
             case 2:
                 $difficulty = "Легкий-средний";
                 break;
             case 3:
                 $difficulty = "Средний";
                 break;
             case 4:
                 $difficulty = "Средний-сложный";
                 break;
             case 5:
                 $difficulty = "Сложный";
                 break;
             default:
                 $difficulty = $movie->in_roles;
         }
         if (!$movie) {
             Error::httpError(404);
         }
         $this->view("movies/serial_show", array("movie" => $movie, "seasons" => $seasons, "rating" => $rating, "rating_count" => $rating_count, "difficulty" => $difficulty, "user" => $user, "user_major" => $user_major), false);
     } else {
         $this->redirect("/");
     }
 }
开发者ID:bionicle12,项目名称:testsite,代码行数:36,代码来源:MoviesController.php


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