• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP error_get_last函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _shutdownHandler

 /**
  * Shutdown handler for log fatal errors
  */
 public static function _shutdownHandler()
 {
     $error = error_get_last();
     if (self::$sendErrors && in_array($error['type'], self::$unrecoverable)) {
         Rollbar::report_exception($error);
     }
 }
开发者ID:tomaj,项目名称:nette-rollbar,代码行数:10,代码来源:RollbarDebugger.php


示例2: handleFatalError

 /**
  * 处理致命错误
  */
 function handleFatalError()
 {
     if ($e = error_get_last()) {
         $msg = $e['message'] . " in " . $e['file'] . ' line ' . $e['line'];
         log_message('error', 'PHP Fatal error: ' . $msg);
     }
 }
开发者ID:shaoyi88,项目名称:mis,代码行数:10,代码来源:MIS_Controller.php


示例3: test_admin_panel_edit_user

 /**
  * @covers Starter\routers\RestRouter::admin_panel_edit_user
  */
 public function test_admin_panel_edit_user()
 {
     ob_start();
     $this->router->admin_panel_edit_user(1);
     ob_end_clean();
     self::assertNull(error_get_last());
 }
开发者ID:one-more,项目名称:peach_framework,代码行数:10,代码来源:RestRouterTest.php


示例4: shutdown

/**
 * shutdown函数,用于捕获至命错误
 */
function shutdown()
{
    $error = error_get_last();
    if ($error) {
        show_error($error['message'], $error['type'], $error['file'], $error['line']);
    }
}
开发者ID:boxcore,项目名称:xspider,代码行数:10,代码来源:core.fn.php


示例5: breathe_shutdown_function

/**
 * 
 */
function breathe_shutdown_function()
{
    $error = error_get_last();
    if ($error !== null) {
        error::Ret()->Log('breathe_shutdown_function: ' . print_r($error, true));
    }
}
开发者ID:kydreth,项目名称:BreathePHP,代码行数:10,代码来源:error.php


示例6: check_for_fatal

/**
 * Checks for a fatal error, work around for set_error_handler not working on fatal errors.
 */
function check_for_fatal()
{
    $error = error_get_last();
    if ($error["type"] == E_ERROR) {
        errorHandler($error["type"], $error["message"], $error["file"], $error["line"]);
    }
}
开发者ID:edwardshe,项目名称:sublite-1,代码行数:10,代码来源:error.php


示例7: handleFatal

 /**
  * Log fatal error to Mautic's logs and throw exception for the parent generic error page to catch
  *
  * @throws \Exception
  */
 public function handleFatal()
 {
     $error = error_get_last();
     if ($error !== null) {
         $name = $this->getErrorName($error['type']);
         $this->logger->error("{$name}: {$error['message']} - in file {$error['file']} - at line {$error['line']}");
         if ($error['type'] === E_ERROR || $error['type'] === E_CORE_ERROR || $error['type'] === E_USER_ERROR) {
             defined('MAUTIC_OFFLINE') or define('MAUTIC_OFFLINE', 1);
             if (MAUTIC_ENV == 'dev') {
                 $message = "<pre>{$error['message']} - in file {$error['file']} - at line {$error['line']}</pre>";
                 // Get a trace
                 ob_start();
                 debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
                 $trace = ob_get_contents();
                 ob_end_clean();
                 // Remove first item from backtrace as it's this function which
                 // is redundant.
                 $trace = preg_replace('/^#0\\s+' . __FUNCTION__ . "[^\n]*\n/", '', $trace, 1);
                 // Renumber backtrace items.
                 $trace = preg_replace('/^#(\\d+)/me', '\'#\' . ($1 - 1)', $trace);
                 $submessage = "<pre>{$trace}</pre>";
             } else {
                 $message = 'The site is currently offline due to encountering an error. If the problem persists, please contact the system administrator.';
                 $submessage = 'System administrators, check server logs for errors.';
             }
             include __DIR__ . '/../../../../offline.php';
         }
     }
 }
开发者ID:Yame-,项目名称:mautic,代码行数:34,代码来源:ErrorHandlingListener.php


示例8: run

 /**
  * Run application
  *
  * @return bool|\Phalcon\Http\ResponseInterface
  */
 public function run()
 {
     $this->_initLoader($this->_dependencyInjector);
     $this->_initServices($this->_dependencyInjector, $this->config);
     $this->_initModule();
     $handle = $this->handle();
     if ($this->config->logError) {
         $error = error_get_last();
         if ($error) {
             $logKey = md5(implode('|', $error));
             /**
              * @var $corePhpLog CorePhpLogs
              */
             $corePhpLog = CorePhpLogs::findFirst(['conditions' => 'log_key = ?0', 'bind' => [$logKey]]);
             if ($corePhpLog) {
                 $corePhpLog->status = 0;
             } else {
                 $corePhpLog = new CorePhpLogs();
                 $corePhpLog->assign(['log_key' => $logKey, 'type' => $error['type'], 'message' => $error['message'], 'file' => $error['file'], 'line' => $error['line'], 'status' => 0]);
             }
             $corePhpLog->save();
         }
     }
     return $handle;
 }
开发者ID:kimthangatm,项目名称:zcms,代码行数:30,代码来源:ZApplication.php


示例9: __construct

 public function __construct($filename = null, array $options = array(), $binary = false, $type = null)
 {
     $this->filename = $filename;
     $this->remote = false;
     $this->binary = (bool) $binary;
     $this->assertFileAvaiable();
     $this->detectFormat($type);
     if ($this->binary) {
         $this->oldImage = @imagecreatefromstring($this->filename);
     } else {
         switch ($this->format) {
             case self::TYPE_PNG:
                 $this->oldImage = @imagecreatefrompng($this->filename);
                 break;
             case self::TYPE_JPEG:
                 $this->oldImage = @imagecreatefromjpeg($this->filename);
                 break;
             case self::TYPE_GIF:
                 $this->oldImage = @imagecreatefromgif($this->filename);
                 break;
         }
     }
     if (!$this->oldImage) {
         $error = error_get_last();
         throw new \InvalidArgumentException('create image with given resource failed' . ($error ? ' with error ' . $error['message'] : ''));
     }
     $this->currentDimensions = array('width' => imagesx($this->oldImage), 'height' => imagesy($this->oldImage));
     $this->setOptions($options);
 }
开发者ID:musicsnap,项目名称:Yaf.Global.Library,代码行数:29,代码来源:Image.php


示例10: sgfun

function sgfun($filter, $params = null)
{
    $fp = fopen('php://memory', 'w');
    $filter = @stream_filter_append($fp, $filter, STREAM_FILTER_WRITE, $params);
    if ($filter === false) {
        fclose($fp);
        $error = error_get_last() + array('message' => '');
        throw new RuntimeException('Unable to access built-in filter: ' . $error['message']);
    }
    // append filter function which buffers internally
    $buffer = '';
    sgappend($fp, function ($chunk) use(&$buffer) {
        $buffer .= $chunk;
        // always return empty string in order to skip actually writing to stream resource
        return '';
    }, STREAM_FILTER_WRITE);
    $closed = false;
    return function ($chunk = null) use($fp, $filter, &$buffer, &$closed) {
        if ($closed) {
            throw new RuntimeException('Unable to perform operation on closed stream');
        }
        if ($chunk === null) {
            $closed = true;
            $buffer = '';
            fclose($fp);
            return $buffer;
        }
        // initialize buffer and invoke filters by attempting to write to stream
        $buffer = '';
        fwrite($fp, $chunk);
        // buffer now contains everything the filter function returned
        return $buffer;
    };
}
开发者ID:Finzy,项目名称:stageDB,代码行数:34,代码来源:FilterFns.php


示例11: shutdown

 /**
  * Método executado quando ocorre algum erro fatal no PHP, esse método é chamado 
  * antes que o PHP pare a execução da página
  * @return	void
  */
 public static function shutdown()
 {
     $error = error_get_last();
     if (is_array($error)) {
         self::handle($error['type'], $error['message'], $error['file'], $error['line']);
     }
 }
开发者ID:nylmarcos,项目名称:estagio,代码行数:12,代码来源:Error.php


示例12: tierShutdownFunction

    /**
     * This fatal error shutdown handler will only get called when there is a serious fatal
     * error with your application.
     */
    public static function tierShutdownFunction()
    {
        $fatals = [E_ERROR, E_PARSE, E_USER_ERROR, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING];
        $lastError = error_get_last();
        if (empty($lastError) !== true && in_array($lastError['type'], $fatals) === true) {
            if (headers_sent() === true) {
                return;
            }
            extract($lastError);
            $msg = sprintf("Fatal error: %s in %s on line %d", $message, $file, $line);
            $preStyles = ["color: red", "white-space: pre-wrap", "white-space: -moz-pre-wrap", "white-space: -pre-wrap", "white-space: -o-pre-wrap", "word-wrap: break-word"];
            $preStyle = implode(";", $preStyles);
            $html = <<<HTML
<html>
  <body>
    <h1>500 Internal Server Error</h1>
    <hr/>
    <pre style='%s'>%s</pre>
  </body>
</html>
HTML;
            $output = sprintf($html, $preStyle, $msg);
            $body = new HtmlBody($output, 500);
            self::sendRawBodyResponse($body);
        }
    }
开发者ID:danack,项目名称:tier,代码行数:30,代码来源:HTTPFunction.php


示例13: createTrace

 public function createTrace($type = null, $message = null, $file = null, $line = null, $custom_data = array())
 {
     if (empty($type)) {
         $e = error_get_last();
         if (!empty($e)) {
             $message = $e['message'];
             $file = $e['file'];
             $type = $e['type'];
             $line = $e['line'];
         }
     }
     if (!empty($type)) {
         $levels = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice');
         // Set error type
         $type = isset($levels[$type]) ? $levels[$type] : 'Unknown';
         // Fetch router
         $router =& load_class('Router', 'core');
         // Set up the trace file (1 level is better than none)
         $trace = array();
         $trace[0] = array();
         $trace[0]['function'] = $router->fetch_method();
         $trace[0]['class'] = $router->fetch_class();
         $trace[0]['type'] = $type;
         $trace[0]['args'] = array();
         $trace[0]['file'] = $file;
         $trace[0]['line'] = $line;
         // Send to airbrake
         self::sendToTracker($type . ': ' . $message, $type, $trace, $custom_data);
     }
 }
开发者ID:iweave,项目名称:unmark,代码行数:30,代码来源:Exceptional.php


示例14: setUpExceptionHandler

 /**
  * @inheritdoc
  */
 protected function setUpExceptionHandler(SapiInterface $sapi, ContainerInterface $container)
 {
     error_reporting(E_ALL);
     $createHandler = function () use($container) {
         $has = $container->has(ExceptionHandlerInterface::class);
         $handler = $has === true ? $container->get(ExceptionHandlerInterface::class) : new DefaultHandler();
         return $handler;
     };
     $throwableHandler = function (Throwable $throwable) use($sapi, $container, $createHandler) {
         /** @var ExceptionHandlerInterface $handler */
         $handler = $createHandler();
         $handler->handleThrowable($throwable, $sapi, $container);
     };
     $exceptionHandler = function (Exception $exception) use($sapi, $container, $createHandler) {
         /** @var ExceptionHandlerInterface $handler */
         $handler = $createHandler();
         $handler->handleException($exception, $sapi, $container);
     };
     set_exception_handler(PHP_MAJOR_VERSION >= 7 ? $throwableHandler : $exceptionHandler);
     set_error_handler(function ($severity, $message, $fileName, $lineNumber) use($exceptionHandler) {
         $errorException = new ErrorException($message, 0, $severity, $fileName, $lineNumber);
         $exceptionHandler($errorException);
         throw $errorException;
     });
     // handle fatal error
     register_shutdown_function(function () use($container, $createHandler) {
         $error = error_get_last();
         if ($error !== null && (int) $error['type'] & (E_ERROR | E_COMPILE_ERROR)) {
             /** @var ExceptionHandlerInterface $handler */
             $handler = $createHandler();
             $handler->handleFatal($error, $container);
         }
     });
 }
开发者ID:limoncello-php,项目名称:app,代码行数:37,代码来源:Application.php


示例15: log_error

function log_error($param)
{
    $logdir = APP_ROOT . APP_DIR . '/webroot/data/logs/';
    if (!is_dir($logdir)) {
        return;
    }
    $error = error_get_last();
    function_exists('fastcgi_finish_request') && fastcgi_finish_request();
    if (!is_array($error) || !in_array($error['type'], array(E_ERROR, E_COMPILE_ERROR, E_CORE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR))) {
        return;
    }
    $error = '';
    $error .= date('Y-m-d H:i:s') . '--';
    //$error .= 'Type:' . $error['type'] . '--';
    $error .= 'Msg:' . $error['message'] . '--';
    $error .= 'File:' . $error['file'] . '--';
    $error .= 'Line:' . $error['line'] . '--';
    $error .= 'Ip:' . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0') . '--';
    $error .= 'Uri:' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . '--';
    $error .= empty($_SERVER['CONTENT_TYPE']) ? '' : 'Content-Type:' . $_SERVER['CONTENT_TYPE'] . '--';
    $error .= $_SERVER['REQUEST_METHOD'] . $_SERVER['REQUEST_URI'];
    $error .= '<br/>';
    $size = file_exists($file) ? @filesize($file) : 0;
    file_put_contents($logdir . $param['file'], $error, $size < $param['maxsize'] ? FILE_APPEND : null);
}
开发者ID:justlikeheaven,项目名称:buxun,代码行数:25,代码来源:log.php


示例16: setupErrors

 /**
  * Configures PHP error handling.
  * @return void
  */
 public static function setupErrors()
 {
     error_reporting(E_ALL | E_STRICT);
     ini_set('display_errors', TRUE);
     ini_set('html_errors', FALSE);
     ini_set('log_errors', FALSE);
     set_exception_handler(array(__CLASS__, 'handleException'));
     set_error_handler(function ($severity, $message, $file, $line) {
         if (in_array($severity, array(E_RECOVERABLE_ERROR, E_USER_ERROR), TRUE) || ($severity & error_reporting()) === $severity) {
             Environment::handleException(new \ErrorException($message, 0, $severity, $file, $line));
         }
         return FALSE;
     });
     register_shutdown_function(function () {
         Assert::$onFailure = array(__CLASS__, 'handleException');
         // note that Runner is unable to catch this errors in CLI & PHP 5.4.0 - 5.4.6 due PHP bug #62725
         $error = error_get_last();
         register_shutdown_function(function () use($error) {
             if (in_array($error['type'], array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE), TRUE)) {
                 if (($error['type'] & error_reporting()) !== $error['type']) {
                     // show fatal errors hidden by @shutup
                     echo "\nFatal error: {$error['message']} in {$error['file']} on line {$error['line']}\n";
                 }
             } elseif (Environment::$checkAssertions && !Assert::$counter) {
                 echo "\nError: This test forgets to execute an assertion.\n";
                 exit(Runner\Job::CODE_FAIL);
             }
         });
     });
 }
开发者ID:cujan,项目名称:vcelyweb,代码行数:34,代码来源:Environment.php


示例17: shutdown

function shutdown()
{
    $error = error_get_last();
    if ($error['type'] != 0) {
        var_dump($error);
    }
}
开发者ID:rukzuk,项目名称:rukzuk,代码行数:7,代码来源:initBootstrap.php


示例18: shutdown

function shutdown()
{
    $error = error_get_last();
    if ($error['type'] === E_ERROR) {
        echo json_encode(array('error' => sprintf(__('<strong>PHP Error</strong> line %s: %s'), $error['line'], $error['message'])));
    }
}
开发者ID:expressive-analytics,项目名称:docker-dt-standard.php,代码行数:7,代码来源:users.pml.php


示例19: error_alert

function error_alert()
{
	$sTableID = "tbl_php_commandline";
	$arErrorType = array(
		E_ERROR => "Fatal error",
		E_PARSE => "Parse error",
	);
	$e = error_get_last();
	if(is_null($e) === false && isset($arErrorType[$e['type']]))
	{
		ob_end_clean();
		echo "<h2>".GetMessage("php_cmd_error")."&nbsp;</h2><p>";
		echo '<b>'.$arErrorType[$e['type']].'</b>: '.htmlspecialcharsbx($e['message']).' in <b>'.htmlspecialcharsbx($e['file']).'</b> on line <b>'.htmlspecialcharsbx($e['line']).'</b>';
	}
	else
	{
		global $DB;
		if(
			isset($DB)
			&& is_object($DB)
			&& $DB->GetErrorMessage() != ''
		)
		{
			ob_end_clean();
			echo "<h2>".GetMessage("php_cmd_error")."&nbsp;</h2><p>";
			echo '<font color=#ff0000>Query Error: '.htmlspecialcharsbx($DB->GetErrorSQL()).'</font> ['.htmlspecialcharsbx($DB->GetErrorMessage()).']';
		}
	}
}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:29,代码来源:php_command_line.php


示例20: fatalErrorPhp

 public function fatalErrorPhp()
 {
     $debug = isset($this->core->conf->system->core->debug['errors']) ? $this->core->conf->system->core->debug['errors'] : true;
     $mr = isset($this->core->conf->system->core->debug['mail-report']) ? $this->core->conf->system->core->debug['mail-report'] : true;
     $error = error_get_last();
     if (isset($error)) {
         //Если фатальная ошибка, то обработка этой ошибки
         if ($error['type'] == E_ERROR || $error['type'] == E_PARSE || $error['type'] == E_COMPILE_ERROR || $error['type'] == E_CORE_ERROR) {
             ob_end_clean();
             if (empty($this->core->getParams()['api']['code'])) {
                 header('HTTP/1.0 500');
             } else {
                 header('HTTP/1.0 ' . $this->core->getParams()['api']['code']);
             }
             $error['file'] = $this->pathReplacer($error['file']);
             $mysql = $this->core->mysql;
             if (!$debug) {
                 $errA = array('error' => 'Unfortunately, there is an error there. But our team is working on elimination of this problem.');
             } else {
                 $errA = array('error' => "[{$error['type']}][{$error['file']}:{$error['line']}] {$error['message']}\r\n");
             }
             echo json_encode($errA);
             if ($mr && isset($this->core->mail)) {
                 if ($this->core->mysql->isConnect($mysql::DB_NAME)) {
                     $this->core->mail->addWaitingList($this->core->conf->system->core->admin_mail, '000', array('code' => $error['type'], 'msg' => $error['message'], 'file' => $error['file'], 'line' => $error['line'], 'time' => time()));
                 }
             }
             $er_j = json_encode(array('code' => $error['type'], 'msg' => $error['message'], 'file' => $error['file'], 'line' => $error['line'], 'time' => time()));
             $this->core->statCache('error', $er_j, true);
         }
     }
     ob_end_flush();
 }
开发者ID:Kistriver,项目名称:craftengine0,代码行数:33,代码来源:error.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP error_handle函数代码示例发布时间:2022-05-15
下一篇:
PHP error_form_message函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap