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


PHP HTTP::error方法代码示例

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


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

示例1: shutDownFunction

function shutDownFunction()
{
    $error = error_get_last();
    if ($error['type']) {
        HTTP::error(500, $error['type'], $error["message"], $error["file"], $error["line"]);
        return true;
    }
}
开发者ID:HyuchiaDiego,项目名称:AegisFramework,代码行数:8,代码来源:aegis.php

示例2: listen

 public static function listen()
 {
     $found_route = self::findRoute($_SERVER['REQUEST_METHOD'], self::getRoute());
     if ($found_route != null) {
         echo $found_route->run();
     } else {
         HTTP::error(404);
     }
 }
开发者ID:HyuchiaDiego,项目名称:AegisFramework,代码行数:9,代码来源:Router.php

示例3: timeline_for_trans_id

 public function timeline_for_trans_id()
 {
     $trans_id = isset($_REQUEST['id']) ? $_REQUEST['id'] : $_REQUEST['trans_id'];
     $conn = $this->get_connection();
     $transaction = new Transaction();
     if ($transaction->find_by_id($trans_id)) {
         $this->redirect_to(array('action' => 'timeline', 'id' => $transaction->isin));
     } else {
         HTTP::error(404);
     }
 }
开发者ID:emeraldion,项目名称:creso,代码行数:11,代码来源:pagamenti_controller.php

示例4: start_download

 /**
  *	@fn start_download
  *	@short Initiates the download of the file.
  *	@details This method takes control of the response by setting the relevant
  *	HTTP headers for content type, size and cache control, then outputs
  *	the contents of the file to the client.
  */
 public function start_download()
 {
     if (!file_exists($this->filename)) {
         HTTP::error(404);
     }
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header('Content-Description: File Transfer');
     header('Content-Type: application/octet-stream');
     header('Content-Length: ' . filesize($this->filename));
     header('Content-Disposition: attachment; filename=' . basename($this->filename));
     readfile($this->filename);
     exit;
 }
开发者ID:emeraldion,项目名称:zelda,代码行数:20,代码来源:download_manager.php

示例5: _init_software

 /**
  *	@fn _init_software
  *	@short Private method that initializes repetitive members of software product page actions.
  */
 private function _init_software()
 {
     $conn = Db::get_connection();
     if (isset($_REQUEST['software_name'])) {
         $software_factory = new Software();
         $softwares = $software_factory->find_all(array('where_clause' => '`name` = \'' . $conn->escape($_REQUEST['software_name']) . '\' AND `type` = \'' . $conn->escape($_REQUEST['software_type']) . '\'', 'limit' => 1));
         if (count($softwares) > 0) {
             $this->software = $softwares[0];
         } else {
             $softwares = $software_factory->find_by_query('SELECT `softwares`.`id` ' . 'FROM `softwares` ' . 'LEFT JOIN `software_typos` ON `softwares`.`id` = `software_typos`.`software_id` ' . 'WHERE `software_typos`.`typo` = \'' . $conn->escape($_REQUEST['software_name']) . '\' ' . 'LIMIT 1');
             if (count($softwares) > 0) {
                 $this->software = $softwares[0];
                 header(sprintf('Location: http://%s%s', $_SERVER['HTTP_HOST'], $this->software->url_to_detail($_REQUEST['subview'])));
                 exit;
             } else {
                 HTTP::error(404);
             }
         }
         $_REQUEST['id'] = $this->software->id;
     } else {
         if (isset($_GET['id'])) {
             $this->software = new Software();
             if ($this->software->find_by_id($_GET['id']) === FALSE) {
                 $this->flash(l('No such software product!'), 'error');
                 $this->redirect_to(array('action' => 'index'));
             }
         } else {
             HTTP::error(404);
         }
     }
     $this->software->has_many('software_releases', array('where_clause' => '`released` = \'1\''));
     $releases = $this->software->software_releases;
     usort($releases, array($releases[0], 'sort_releases'));
     $this->release = $releases[0];
     $this->software->software_releases = $releases;
     Db::close_connection($conn);
 }
开发者ID:emeraldion,项目名称:zelda,代码行数:41,代码来源:software_controller.php

示例6: go

 /**
  *	@fn go
  *	@short Action method that redirects to an external article.
  */
 public function go()
 {
     $this->article = new DiarioPost();
     if ($this->article->find_by_id($_REQUEST['id']) === FALSE) {
         $this->flash(l('No such article'), 'error');
         $this->redirect_to(array('action' => 'index'));
     }
     if ($this->article->status != 'pubblicato' || $this->article->external_url == NULL) {
         HTTP::error(404);
     }
     // Annotates that the article has been read
     $this->article->readings++;
     $this->article->save();
     header(sprintf('Location: %s', $this->article->external_url));
     exit;
 }
开发者ID:emeraldion,项目名称:zelda,代码行数:20,代码来源:diario_controller.php

示例7: load_part_contents

 /**
  *	@short Loads the contents of the desired view file.
  *	@details This method returns the contents of the requested view file
  *	without parsing.
  *	@param filename The name of the view file to load.
  */
 protected function load_part_contents($filename)
 {
     if (!file_exists($filename)) {
         HTTP::error(500);
     }
     $contents = file_get_contents($filename);
     return $this->strip_external_php_tags($contents);
 }
开发者ID:emeraldion,项目名称:zelda,代码行数:14,代码来源:base_controller.php

示例8: dirname

<?php

require_once dirname(__FILE__) . "/include/common.inc.php";
require_once dirname(__FILE__) . "/helpers/application_helper.php";
require_once dirname(__FILE__) . "/helpers/http.php";
define('APPLICATION_ROOT', '/creso.new/');
try {
    if (isset($_REQUEST['controller']) && !empty($_REQUEST['controller'])) {
        // Include controller class
        $controller_file = dirname(__FILE__) . "/controllers/{$_REQUEST['controller']}_controller.php";
        if (!file_exists($controller_file)) {
            HTTP::error(404);
        }
        require $controller_file;
        // Instantiate main controller
        $main_controller = eval("return new " . ucwords($_REQUEST['controller']) . "Controller();");
        // Request rendering of the page
        // (If action didn't already do it before)
        $main_controller->render_page();
    } else {
        HTTP::error(400);
    }
} catch (Exception $e) {
    die("Exception {$e}");
    HTTP::error(500);
}
开发者ID:emeraldion,项目名称:creso,代码行数:26,代码来源:router.php

示例9: include_localized

 /**
  *	@fn include_localized($filename)
  *	@short Includes a localized version of the requested filename if possible.
  *	@details Checks if a localized version of the requested filename exists, otherwise
  *	calls <tt>include</tt>.
  *	@param filename The name of the file to be included.
  */
 protected function include_localized($filename)
 {
     $localized_filename = @preg_replace("/\\.([^\\.]+)\$/", "-{$_COOKIE['hl']}.\\1", $filename);
     if (file_exists($localized_filename)) {
         include $localized_filename;
     } else {
         if (!file_exists($filename)) {
             HTTP::error(500);
         }
         include $filename;
     }
 }
开发者ID:emeraldion,项目名称:zelda,代码行数:19,代码来源:eme_controller.php

示例10: toggle_favorite

 /**
  *  @fn toggle_favorite
  *  @short Toggles a favorite instrument
  *  @details Action to toggle an instrument as favorite, handles the postback
  *  action to save the model.
  */
 public function toggle_favorite()
 {
     if ($this->request->is_post()) {
         $_POST['isin'] = $_REQUEST['id'];
         if ($this->is_favorite) {
             $this->favorite->delete();
             unset($this->favorite);
             $this->is_favorite = FALSE;
         } else {
             $_POST['isin'] = $_REQUEST['id'];
             $favorite = new Favorite(array('utente' => $_COOKIE['username'], 'isin' => $_POST['isin']));
             $favorite->save();
             $this->is_favorite = TRUE;
         }
         die("{\"isin\":\"{$_REQUEST['id']}\",\"favorite\":" . ($this->is_favorite ? 'true' : 'false') . "}");
     } else {
         HTTP::error(400);
     }
 }
开发者ID:emeraldion,项目名称:creso,代码行数:25,代码来源:titoli_controller.php


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