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


PHP Error类代码示例

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


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

示例1: getErrorData

 /**
  * @return mixed|null
  */
 public function getErrorData()
 {
     if ($this->error instanceof Error) {
         return $this->error->getData();
     }
     return null;
 }
开发者ID:igaponov,项目名称:jsonrpc,代码行数:10,代码来源:Response.php

示例2: handle_errors

function handle_errors($errno, $errstr, $errfile, $errline, $errcontext)
{
    $error = new Error();
    $error->date = date('Y-m-d H:i:s');
    $error->text = $errstr;
    $error->save();
}
开发者ID:emeraldion,项目名称:creso,代码行数:7,代码来源:scheduler.php

示例3: __construct

 /**
  * Creates a new Error.
  *
  * @param string     $message
  * @param Error|null $error
  */
 protected function __construct($message, Error $error = null)
 {
     if (null != $error) {
         $message = $error->message() . ' -> ' . $message;
     }
     $this->message = $message;
 }
开发者ID:tarsana,项目名称:functional,代码行数:13,代码来源:Error.php

示例4: show_php_error

 function show_php_error($severity, $message, $filepath, $line)
 {
     $severity = !isset($this->levels[$severity]) ? $severity : $this->levels[$severity];
     $filepath = str_replace("\\", "/", $filepath);
     // For safety reasons we do not show the full file path
     if (FALSE !== strpos($filepath, '/')) {
         $x = explode('/', $filepath);
         $filepath = $x[count($x) - 2] . '/' . end($x);
     }
     // BEGIN DATABASE LOGGING
     $CI =& get_instance();
     if (is_object($CI) && (!property_exists($CI, 'debugmode') || $CI->debugmode != TRUE)) {
         $e = new Error();
         $e->source = '';
         $e->severity = $severity;
         $e->message = $message;
         $e->filepath = $filepath;
         $e->line = $line;
         $e->application = property('application', $CI, '');
         if (property_exists($CI, 'user')) {
             $e->user_id = $CI->user->id;
         }
         $e->save();
         $error_id = $e->id;
     }
     // END DATABASE LOGGING
     if (ob_get_level() > $this->ob_level + 1) {
         ob_end_flush();
     }
     ob_start();
     include APPPATH . 'errors/error_php' . EXT;
     $buffer = ob_get_contents();
     ob_end_clean();
     echo $buffer;
 }
开发者ID:pmorris,项目名称:CodeIgniter-Libraries,代码行数:35,代码来源:MY_Exceptions.php

示例5: display

 /**
  * Outputs the error popup, or a plain message, depending on the response content type.
  *
  * @param \Exception|\Error      $exception Note: can't be type hinted, for PHP7 compat.
  * @param ResponseInterface|null $response  If null, it outputs directly to the client. Otherwise, it assumes the
  *                                          object is a new blank response.
  * @return ResponseInterface|null
  */
 static function display($exception, ResponseInterface $response = null)
 {
     // For HTML pages, output the error popup
     if (strpos(get($_SERVER, 'HTTP_ACCEPT'), 'text/html') !== false) {
         ob_start();
         ErrorConsoleRenderer::renderStyles();
         $stackTrace = self::getStackTrace($exception->getPrevious() ?: $exception);
         ErrorConsoleRenderer::renderPopup($exception, self::$appName, $stackTrace);
         $popup = ob_get_clean();
         // PSR-7 output
         if ($response) {
             $response->getBody()->write($popup);
             return $response->withStatus(500);
         }
         // Direct output
         echo $popup;
     } else {
         // PSR-7 output
         if ($response) {
             $response->getBody()->write($exception->getMessage());
             if (self::$devEnv) {
                 $response->getBody()->write("\n\nStack trace:\n" . $exception->getTraceAsString());
             }
             return $response->withoutHeader('Content-Type')->withHeader('Content-Type', 'text-plain')->withStatus(500);
         }
         // Direct output
         header("Content-Type: text/plain");
         http_response_code(500);
         echo $exception->getMessage();
         if (self::$devEnv) {
             echo "\n\nStack trace:\n" . $exception->getTraceAsString();
         }
     }
     return null;
 }
开发者ID:impactwave,项目名称:php-web-console,代码行数:43,代码来源:ErrorConsole.php

示例6: error

 function error()
 {
     require 'controllers/' . EQ_404 . '.php';
     $error = new Error();
     $error->index();
     return false;
 }
开发者ID:eddythemeddy,项目名称:Equinox-CMS,代码行数:7,代码来源:Bootstrap.php

示例7: buildMenuElement

 /**
  * This function creates a HTML-block for a menu item.
  *
  * @access public
  * @author k
  * @param MenuElement $parameters['menuElement']
  *        	the menu element
  * @param string $parameters['type']
  *        	the type
  * @see MenuElement::$type
  * @uses Error for error handling
  * @uses ErrorView for error handling
  * @uses MENU_COMMON for the common menu
  * @uses MENU_SIDE for the menu in sidebar
  */
 public static function buildMenuElement($parameters)
 {
     require_once 'HTML/Template/IT.php';
     $tpl = new \HTML_Template_IT(ROOT_FOLDER . 'html');
     $tpl->loadTemplatefile('particle-template.html');
     switch ($parameters['type']) {
         case MENU_COMMON:
             $tpl->setCurrentBlock('item-in-common-menu');
             $tpl->setVariable(array('HREF-OF-ITEM-IN-COMMON-MENU' => null === $parameters['menuElement']->getHref() ? $parameters['menuElement']->translate(array('property' => 'href', 'isSlug' => true)) : $parameters['menuElement']->getHref(), 'LABEL-OF-ITEM-IN-COMMON-MENU' => $parameters['menuElement']->translate(array('property' => 'label'))));
             $tpl->parse('item-in-common-menu');
             // echo ' 38: ', $tpl->get('menu-item');
             return $tpl->get('item-in-common-menu');
             break;
         case MENU_SIDE:
             $tpl->setCurrentBlock('item-in-menu-in-sidebar');
             $tpl->setVariable(array('HREF-OF-ITEM-IN-MENU-IN-SIDEBAR' => null === $parameters['menuElement']->getHref() ? $parameters['menuElement']->translate(array('property' => 'href', 'isSlug' => true)) : $parameters['menuElement']->getHref(), 'LABEL-OF-ITEM-IN-MENU-IN-SIDEBAR' => $parameters['menuElement']->translate(array('property' => 'label'))));
             $tpl->parse('item-in-menu-in-sidebar');
             return $tpl->get('item-in-menu-in-sidebar');
             break;
         default:
             require_once dirname(__FILE__) . '/Error.php';
             $error = new Error();
             $error->setMessage(\pstk\String::translate('errorWhichMenu'));
             require_once dirname(__FILE__) . '/ErrorView.php';
             ErrorView::raiseError($error);
     }
 }
开发者ID:piiskop,项目名称:pstk,代码行数:42,代码来源:MenuElementView.php

示例8: __construct

 function __construct()
 {
     $url = filter_input(INPUT_GET, 'url');
     $url = rtrim($url, '/');
     $url = explode('/', $url);
     if (empty($url[0])) {
         require 'controllers/controllerIndex.php';
         $controller = new Index();
         $controller->index();
         return false;
     }
     $file = 'controllers/controller' . $url[0] . '.php';
     if (file_exists($file)) {
         require $file;
     } else {
         require 'controllers/controllerError.php';
         $controller = new Error();
         $controller->index($url[0]);
         return false;
     }
     $controller = new $url[0]();
     if (isset($url[1])) {
         if (method_exists($controller, $url[1])) {
             if (isset($url[2])) {
                 $controller->{$url[1]}($url[2]);
             } else {
                 $controller->{$url[1]}();
             }
         } else {
             $controller->index();
         }
     } else {
         $controller->index();
     }
 }
开发者ID:leal32b,项目名称:mvc,代码行数:35,代码来源:Bootstrap.php

示例9: error

 function error()
 {
     require "controller/error.php";
     $controller = new Error();
     $controller->index();
     return false;
 }
开发者ID:hrydi,项目名称:distro,代码行数:7,代码来源:Bootstrap.php

示例10: error

 function error()
 {
     require 'error.php';
     $controlador = new Error();
     $controlador->index();
     return false;
 }
开发者ID:sandyrod,项目名称:mimo,代码行数:7,代码来源:bootstrap.php

示例11: error

 public function error()
 {
     require 'controllers/error.php';
     $controller = new Error();
     $controller->index();
     return false;
 }
开发者ID:alibabaih,项目名称:notepad-php,代码行数:7,代码来源:bootstrap.php

示例12: error

 function error()
 {
     require 'application/controllers/error.php';
     $controller = new Error();
     $controller->Index();
     return false;
 }
开发者ID:WHTGo,项目名称:EXP-Training,代码行数:7,代码来源:bootstrap.php

示例13: error

 public function error($exception)
 {
     require 'lib/controllers/error.controller.php';
     $error = new Error();
     $error->show($exception->getMessage() . '<br />Code: ' . $exception->getCode());
     exit;
 }
开发者ID:rlemon,项目名称:pi.rlemon.com,代码行数:7,代码来源:bootstrap.class.php

示例14: error

 function error($msg = false)
 {
     require 'controllers/error.php';
     $error = new Error();
     $error->index($msg);
     return false;
 }
开发者ID:Rasulbek,项目名称:asiacinema,代码行数:7,代码来源:Start.php

示例15: __construct

 public function __construct()
 {
     $this->getUrlWithoutModRewrite();
     if (!$this->url_controller) {
         require APP . 'controllers/home.php';
         $page = new Home();
         $page->index();
     } elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
         require APP . 'controllers/' . $this->url_controller . '.php';
         $this->url_controller = new $this->url_controller();
         if (method_exists($this->url_controller, $this->url_action)) {
             if (!empty($this->url_params)) {
                 // Llama el metodo y le pasa los argumentos
                 call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
             } else {
                 //Si no hay  parametros llama a el metodo sin argumentos.
                 $this->url_controller->{$this->url_action}();
             }
         } else {
             if (strlen($this->url_action) == 0) {
                 // Si no se define alguna accion defino por defecto la index
                 $this->url_controller->index();
             } else {
                 //Si la accion no existe lanzo el error
                 require APP . 'controllers/error.php';
                 $page = new Error();
                 $page->index();
             }
         }
     } else {
         require APP . 'controllers/error.php';
         $page = new Error();
         $page->index();
     }
 }
开发者ID:EmmanuelSW,项目名称:Eswood,代码行数:35,代码来源:application.php


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