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


PHP error_handled函数代码示例

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


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

示例1: print_header_redirect

function print_header_redirect($p_url, $p_die = true, $p_sanitize = false)
{
    $t_use_iis = config_get('use_iis');
    if (ON == config_get('stop_on_errors') && error_handled()) {
        return false;
    }
    # validate the url as part of this site before continuing
    $t_url = $p_sanitize ? string_sanitize_url($p_url) : $p_url;
    # don't send more headers if they have already been sent (guideweb)
    if (!headers_sent()) {
        header('Content-Type: text/html; charset=' . lang_get('charset'));
        if (ON == $t_use_iis) {
            header("Refresh: 0;url={$t_url}");
        } else {
            header("Location: {$t_url}");
        }
    } else {
        trigger_error(ERROR_PAGE_REDIRECTION, ERROR);
        return false;
    }
    if ($p_die) {
        die;
        # additional output can cause problems so let's just stop output here
    }
    return true;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:26,代码来源:print_api.php

示例2: print_header_redirect

function print_header_redirect($p_url, $p_die = true, $p_sanitize = false, $p_absolute = false)
{
    if (ON == config_get_global('stop_on_errors') && error_handled()) {
        return false;
    }
    # validate the url as part of this site before continuing
    if ($p_absolute) {
        if ($p_sanitize) {
            $t_url = string_sanitize_url($p_url);
        } else {
            $t_url = $p_url;
        }
    } else {
        if ($p_sanitize) {
            $t_url = string_sanitize_url($p_url, true);
        } else {
            $t_url = config_get('path') . $p_url;
        }
    }
    $t_url = string_prepare_header($t_url);
    # don't send more headers if they have already been sent (guideweb)
    if (!headers_sent()) {
        header('Content-Type: text/html; charset=utf-8');
        header("Location: {$t_url}");
    } else {
        trigger_error(ERROR_PAGE_REDIRECTION, ERROR);
        return false;
    }
    if ($p_die) {
        die;
        # additional output can cause problems so let's just stop output here
    }
    return true;
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:34,代码来源:print_api.php

示例3: html_meta_redirect

function html_meta_redirect($p_url, $p_time = null, $p_sanitize = false)
{
    if (ON == config_get('stop_on_errors') && error_handled()) {
        return false;
    }
    if (null === $p_time) {
        $p_time = current_user_get_pref('redirect_delay');
    }
    if ($p_sanitize) {
        $t_url = string_sanitize_url($p_url);
    } else {
        $t_url = $p_url;
    }
    echo "\t<meta http-equiv=\"Refresh\" content=\"{$p_time};URL={$t_url}\" />\n";
    return true;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:16,代码来源:html_api.php

示例4: error_handler

/**
 * Default error handler
 *
 * This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_*
 *  errors.
 *
 * E_USER_* are triggered by us and will contain an error constant in $p_error
 * The others, being system errors, will come with a string in $p_error
 *
 * @access private
 * @param integer $p_type    Contains the level of the error raised, as an integer.
 * @param string  $p_error   Contains the error message, as a string.
 * @param string  $p_file    Contains the filename that the error was raised in, as a string.
 * @param integer $p_line    Contains the line number the error was raised at, as an integer.
 * @param array   $p_context To the active symbol table at the point the error occurred (optional).
 * @return void
 * @uses lang_api.php
 * @uses config_api.php
 * @uses compress_api.php
 * @uses database_api.php (optional)
 * @uses html_api.php (optional)
 */
function error_handler($p_type, $p_error, $p_file, $p_line, array $p_context)
{
    global $g_error_parameters, $g_error_handled, $g_error_proceed_url;
    global $g_error_send_page_header;
    # check if errors were disabled with @ somewhere in this call chain
    if (0 == error_reporting()) {
        return;
    }
    $t_lang_pushed = false;
    $t_db_connected = false;
    if (function_exists('db_is_connected')) {
        if (db_is_connected()) {
            $t_db_connected = true;
        }
    }
    $t_html_api = false;
    if (function_exists('html_end')) {
        $t_html_api = true;
    }
    # flush any language overrides to return to user's natural default
    if ($t_db_connected) {
        lang_push(lang_get_default());
        $t_lang_pushed = true;
    }
    $t_method_array = config_get_global('display_errors');
    if (isset($t_method_array[$p_type])) {
        $t_method = $t_method_array[$p_type];
    } else {
        if (isset($t_method_array[E_ALL])) {
            $t_method = $t_method_array[E_ALL];
        } else {
            $t_method = 'none';
        }
    }
    # build an appropriate error string
    $t_error_location = 'in \'' . $p_file . '\' line ' . $p_line;
    $t_error_description = '\'' . $p_error . '\' ' . $t_error_location;
    switch ($p_type) {
        case E_WARNING:
            $t_error_type = 'SYSTEM WARNING';
            break;
        case E_NOTICE:
            $t_error_type = 'SYSTEM NOTICE';
            break;
        case E_STRICT:
            $t_error_type = 'STRICT NOTICE';
            break;
        case E_RECOVERABLE_ERROR:
            # This should generally be considered fatal (like E_ERROR)
            $t_error_type = 'SYSTEM ERROR';
            break;
        case E_DEPRECATED:
            $t_error_type = 'DEPRECATED';
            break;
        case E_USER_ERROR:
            $t_error_type = 'APPLICATION ERROR #' . $p_error;
            $t_error_description = error_string($p_error);
            if ($t_method == DISPLAY_ERROR_INLINE) {
                $t_error_description .= ' (' . $t_error_location . ")\n" . error_string(ERROR_DISPLAY_USER_ERROR_INLINE);
            }
            break;
        case E_USER_WARNING:
            $t_error_type = 'APPLICATION WARNING #' . $p_error;
            $t_error_description = error_string($p_error) . ' (' . $t_error_location . ')';
            break;
        case E_USER_NOTICE:
            # used for debugging
            $t_error_type = 'DEBUG';
            break;
        case E_USER_DEPRECATED:
            # Get the parent of the call that triggered the error to facilitate
            # debugging with a more useful filename and line number
            $t_stack = debug_backtrace();
            $t_caller = $t_stack[2];
            $t_error_type = 'WARNING';
            $t_error_description = error_string($p_error) . ' (in ' . $t_caller['file'] . ' line ' . $t_caller['line'] . ')';
            if ($t_method == DISPLAY_ERROR_INLINE && php_sapi_name() != 'cli') {
                # Enqueue messages for later display with error_print_delayed()
//.........这里部分代码省略.........
开发者ID:spring,项目名称:spring-website,代码行数:101,代码来源:error_api.php

示例5: html_meta_redirect

/**
 * (6) Print an HTML meta tag to redirect to another page
 * This function is optional and may be called by pages that need a redirect.
 * $p_time is the number of seconds to wait before redirecting.
 * If we have handled any errors on this page return false and don't redirect.
 *
 * @param string  $p_url      The page to redirect: has to be a relative path.
 * @param integer $p_time     Seconds to wait for before redirecting.
 * @param boolean $p_sanitize Apply string_sanitize_url to passed URL.
 * @return boolean
 */
function html_meta_redirect($p_url, $p_time = null, $p_sanitize = true)
{
    if (ON == config_get_global('stop_on_errors') && error_handled()) {
        return false;
    }
    if (null === $p_time) {
        $p_time = current_user_get_pref('redirect_delay');
    }
    $t_url = config_get('path');
    if ($p_sanitize) {
        $t_url .= string_sanitize_url($p_url);
    } else {
        $t_url .= $p_url;
    }
    $t_url = htmlspecialchars($t_url);
    echo "\t" . '<meta http-equiv="Refresh" content="' . $p_time . ';URL=' . $t_url . '" />' . "\n";
    return true;
}
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:29,代码来源:html_api.php

示例6: error_handler

/**
 * Default error handler
 *
 * This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_*
 *  errors.
 *
 * E_USER_* are triggered by us and will contain an error constant in $p_error
 * The others, being system errors, will come with a string in $p_error
 *
 * @access private
 * @param int p_type contains the level of the error raised, as an integer.
 * @param string p_error contains the error message, as a string.
 * @param string p_file contains the filename that the error was raised in, as a string.
 * @param int p_line contains the line number the error was raised at, as an integer.
 * @param array p_context to the active symbol table at the point the error occurred (optional)
 * @uses lang_api.php
 * @uses config_api.php
 * @uses compress_api.php
 * @uses database_api.php (optional)
 * @uses html_api.php (optional)
 */
function error_handler($p_type, $p_error, $p_file, $p_line, $p_context)
{
    global $g_error_parameters, $g_error_handled, $g_error_proceed_url;
    global $g_lang_overrides;
    global $g_error_send_page_header;
    # check if errors were disabled with @ somewhere in this call chain
    if (0 == error_reporting()) {
        return;
    }
    $t_lang_pushed = false;
    $t_db_connected = false;
    if (function_exists('db_is_connected')) {
        if (db_is_connected()) {
            $t_db_connected = true;
        }
    }
    $t_html_api = false;
    if (function_exists('html_end')) {
        $t_html_api = true;
    }
    # flush any language overrides to return to user's natural default
    if ($t_db_connected) {
        lang_push(lang_get_default());
        $t_lang_pushed = true;
    }
    $t_short_file = basename($p_file);
    $t_method_array = config_get_global('display_errors');
    if (isset($t_method_array[$p_type])) {
        $t_method = $t_method_array[$p_type];
    } else {
        if (isset($t_method_array[E_ALL])) {
            $t_method = $t_method_array[E_ALL];
        } else {
            $t_method = 'none';
        }
    }
    # build an appropriate error string
    switch ($p_type) {
        case E_WARNING:
            $t_error_type = 'SYSTEM WARNING';
            $t_error_description = "'{$p_error}' in '{$p_file}' line {$p_line}";
            break;
        case E_NOTICE:
            $t_error_type = 'SYSTEM NOTICE';
            $t_error_description = "'{$p_error}' in '{$p_file}' line {$p_line}";
            break;
        case E_USER_ERROR:
            $t_error_type = "APPLICATION ERROR #{$p_error}";
            $t_error_description = error_string($p_error);
            break;
        case E_USER_WARNING:
            $t_error_type = "APPLICATION WARNING #{$p_error}";
            $t_error_description = error_string($p_error);
            break;
        case E_USER_NOTICE:
            # used for debugging
            $t_error_type = 'DEBUG';
            $t_error_description = $p_error;
            break;
        default:
            # shouldn't happen, just display the error just in case
            $t_error_type = '';
            $t_error_description = $p_error;
    }
    $t_error_description = nl2br($t_error_description);
    switch ($t_method) {
        case 'halt':
            # disable any further event callbacks
            if (function_exists('event_clear_callbacks')) {
                event_clear_callbacks();
            }
            $t_oblen = ob_get_length();
            if (error_handled() && $t_oblen > 0) {
                $t_old_contents = ob_get_contents();
            }
            # We need to ensure compression is off - otherwise the compression headers are output.
            compress_disable();
            # then clean the buffer, leaving output buffering on.
            if ($t_oblen > 0) {
//.........这里部分代码省略.........
开发者ID:rahmanjis,项目名称:dipstart-development,代码行数:101,代码来源:error_api.php

示例7: error_handler

/**
 * Default error handler
 *
 * This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_*
 *  errors.
 *
 * E_USER_* are triggered by us and will contain an error constant in $p_error
 * The others, being system errors, will come with a string in $p_error
 *
 * @access private
 * @param int p_type contains the level of the error raised, as an integer.
 * @param string p_error contains the error message, as a string.
 * @param string p_file contains the filename that the error was raised in, as a string.
 * @param int p_line contains the line number the error was raised at, as an integer.
 * @param array p_context to the active symbol table at the point the error occurred (optional)
 * @uses lang_api.php
 * @uses config_api.php
 * @uses compress_api.php
 * @uses database_api.php (optional)
 * @uses html_api.php (optional)
 */
function error_handler($p_type, $p_error, $p_file, $p_line, $p_context)
{
    global $g_error_parameters, $g_error_handled, $g_error_proceed_url;
    global $g_lang_overrides;
    global $g_error_send_page_header;
    # check if errors were disabled with @ somewhere in this call chain
    if (0 == error_reporting()) {
        return;
    }
    $t_lang_pushed = false;
    $t_db_connected = false;
    if (function_exists('db_is_connected')) {
        if (db_is_connected()) {
            $t_db_connected = true;
        }
    }
    $t_html_api = false;
    if (function_exists('html_end')) {
        $t_html_api = true;
    }
    # flush any language overrides to return to user's natural default
    if ($t_db_connected) {
        lang_push(lang_get_default());
        $t_lang_pushed = true;
    }
    $t_short_file = basename($p_file);
    $t_method_array = config_get_global('display_errors');
    if (isset($t_method_array[$p_type])) {
        $t_method = $t_method_array[$p_type];
    } else {
        if (isset($t_method_array[E_ALL])) {
            $t_method = $t_method_array[E_ALL];
        } else {
            $t_method = 'none';
        }
    }
    # build an appropriate error string
    switch ($p_type) {
        case E_WARNING:
            $t_error_type = 'SYSTEM WARNING';
            $t_error_description = "'{$p_error}' in '{$p_file}' line {$p_line}";
            break;
        case E_NOTICE:
            $t_error_type = 'SYSTEM NOTICE';
            $t_error_description = "'{$p_error}' in '{$p_file}' line {$p_line}";
            break;
        case E_USER_ERROR:
            $t_error_type = "APPLICATION ERROR #{$p_error}";
            $t_error_description = error_string($p_error);
            if ($t_method == DISPLAY_ERROR_INLINE) {
                $t_error_description .= "\n" . error_string(ERROR_DISPLAY_USER_ERROR_INLINE);
            }
            break;
        case E_USER_WARNING:
            $t_error_type = "APPLICATION WARNING #{$p_error}";
            $t_error_description = error_string($p_error);
            break;
        case E_USER_NOTICE:
            # used for debugging
            $t_error_type = 'DEBUG';
            $t_error_description = $p_error;
            break;
        default:
            # shouldn't happen, just display the error just in case
            $t_error_type = '';
            $t_error_description = $p_error;
    }
    $t_error_description = nl2br($t_error_description);
    switch ($t_method) {
        case DISPLAY_ERROR_HALT:
            # disable any further event callbacks
            if (function_exists('event_clear_callbacks')) {
                event_clear_callbacks();
            }
            $t_oblen = ob_get_length();
            if ($t_oblen > 0) {
                $t_old_contents = ob_get_contents();
                if (!error_handled()) {
                    # Retrieve the previously output header
//.........这里部分代码省略.........
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:101,代码来源:error_api.php


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