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

PHP backtrace函数代码示例

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

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



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

示例1: query

 function query($que)
 {
     $t1 = microtime(true);
     global $_SQLDEBUG, $_BACKTRACE;
     if ($_SQLDEBUG) {
         mydump($que);
     }
     if ($_BACKTRACE) {
         mydump(backtrace());
         //debug_print_backtrace();
     }
     if (!($ret = @mysql_query($que, $this->link))) {
         mylog($que, 'dberror');
         mylog(mysql_errno($this->link) . " : " . mysql_error($this->link), 'dberror');
         throw new MysqlException("Error in query {$que}:" . mysql_error($this->link));
     }
     $t2 = microtime(true);
     $time = $t2 - $t1;
     $this->totalQueTime += $time;
     if ($_SQLDEBUG) {
         mydump(sprintf("time: %.05f sec", $time));
     }
     if ($_SQLDEBUG) {
         mydump(sprintf("totaltime: %.05f sec", $this->totalQueTime));
     }
     return $ret;
 }
开发者ID:alex-k,项目名称:velotur,代码行数:27,代码来源:class_dblevel.php


示例2: backtrace

function backtrace($i)
{
    if ($i < 6) {
        return backtrace($i + 1);
    }
    echo $cool;
}
开发者ID:ankane,项目名称:exceptional-php,代码行数:7,代码来源:advanced.php


示例3: bail

/**
    Main Utilities
    
    Helper functions used throughout the system.
    
    @package utility
*/
function bail($msg)
{
    if (is_array($msg)) {
        $msg = array_dump($msg);
    }
    $html = '';
    if (class_exists('Router')) {
        $router = Router::singleton();
        $html .= '
        <h1 style="margin-bottom:0;">' . $router->controller . '</h1>
        <h3 style="margin:4px 0;">Action: ' . $router->action . '</h3>
        <h3 style="margin:4px 0;">Method: ' . $router->method . '</h3>
        <h3 style="margin:6px 0 2px 0;"><u>Params</u></h3></dt> 
        ' . array_dump($router->params()) . '
        ';
    }
    $html .= '
        <h2 style="margin-bottom:2px;">ERROR MESSAGE</h2><pre>' . $msg . '</pre><br>
        <h2 style="margin-bottom:6px;">BACKTRACE</h2>
        ' . backtrace() . '
        ';
    echo $html;
    trigger_error(strip_tags($msg));
    exit;
}
开发者ID:radicaldesigns,项目名称:gtd,代码行数:32,代码来源:main_utilities.php


示例4: log_warning

function log_warning($str, $file = '', $line = '')
{
    if (empty($file) || empty($line)) {
        $file = backtrace(1, 'file');
        $line = backtrace(1, 'line');
    }
    $GLOBALS['engine_errors']['warning'][] = array('file' => $file, 'line' => $line, 'str' => $str);
}
开发者ID:romlg,项目名称:cms36,代码行数:8,代码来源:error.lib.php


示例5: custom_error_handler

function custom_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
{
    global $EMAIL;
    # If the error is not of a type we were looking for, fall back to default error handler.
    $errno = $errno & error_reporting();
    if ($errno == 0) {
        # Returning false tells PHP to fall back to the default error handler.
        return false;
    }
    # Unless the error is just a warning or notice, let the user know what happened.
    if ($errno != E_WARNING && $errno != E_NOTICE) {
        # Indicate that we had some sort of internal error on the server.
        header('HTTP/1.0 500 Internal Server Error');
        ?>
        <html>
         <head>
          <title>Error</title>
	     </head>
         <body>
          <h1>An unrecoverable error has occured.</h1>
          <h2>An email has been sent to our support team.</h2>
          <h2>We apologize for the inconvenience.</h2>
         </body>
        <html>
<?php 
    }
    $errtype = errno_to_errtype($errno);
    $uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    # NOTE: This is a bit simplified.
    $remote_system = $_SERVER['REMOTE_ADDR'] . ', port ' . $_SERVER['REMOTE_PORT'];
    $date_time = date('Y-m-d H:i:s T');
    $error_message = "\n";
    $error_message .= "Error number: {$errno} ({$errtype})\n";
    $error_message .= "Error string: {$errstr}\n";
    $error_message .= "Error file: {$errfile}\n";
    $error_message .= "Error line: {$errline}\n\n";
    $error_message .= "URI: {$uri}\n";
    $error_message .= "Remote IP: {$remote_system}\n";
    $error_message .= "Date and time: {$date_time}\n\n";
    $error_message .= backtrace();
    $error_message .= "\n";
    $error_message .= dump_globals();
    $error_message .= "\n";
    print '<div style="background:#FFAAAA; border:solid #FF0000 5px"><h3>PHP ERROR</h3><pre>';
    print $error_message;
    print '</pre></div>';
    # Email the error message to the admin(s).
    $subject = "An error occured on the XXXXX web site.";
    $headers = "From: {$EMAIL['from']}\r\n";
    # TODO: Only send email if in production. (Or use a config setting.)
    #	mail($EMAIL['report_errors_to'], $subject, $error_message, $headers);
    # If it's just a warning or a notice, let the program continue.
    if ($errno == E_WARNING || $errno == E_NOTICE) {
        return;
    } else {
        die;
    }
}
开发者ID:boochtek,项目名称:php-base,代码行数:58,代码来源:error_handler.php


示例6: getHTML

 function getHTML($message = null)
 {
     $html = '';
     $html .= '<h2>' . get_class($this) . (isset($message) ? ': ' . $message : '') . '</h2>';
     $html .= '<p>' . $this->getMessage() . '</p>';
     $html .= '<p><font color=blue>' . $this->getMyFile() . ':' . $this->getMyLine() . '</font></p>';
     $html .= $this->getDetailedHTML();
     $html .= backtrace($this->shift + 1, $this->getMyTrace());
     return $html;
 }
开发者ID:easyconn,项目名称:atk4,代码行数:10,代码来源:SQLException.php


示例7: CreateFromException

 public function CreateFromException($exception)
 {
     ob_start();
     var_dump($exception->getTrace(), 5);
     $stack = str_replace("\t", "----", str_replace("\n", "<br>", ob_get_clean()));
     $data = "<b>MESSAGE:</b> " . $exception->getMessage() . "<br>";
     $data .= "<b>FILE:</b> " . $exception->getFile() . ", " . $exception->getLine() . "<br>";
     $data .= "<b>CODE:</b> " . get_class($exception) . "<br>";
     $data .= "<br><b>BACK TRACE:</b> " . backtrace();
     return $this->Create()->Text($exception->getMessage())->Tags("error " . get_class($exception))->Data($data)->DataType(DataType::html);
 }
开发者ID:nealerickson,项目名称:agents,代码行数:11,代码来源:loggr.php


示例8: test_file_header

function test_file_header($file, $dest_file, $do_include = true)
{
    $file = realpath($file);
    $codehome = dirname(ZESK_ROOT);
    if (begins($file, ZESK_ROOT)) {
        $from_codehome = false;
        $n = strlen(ZESK_ROOT);
    } else {
        if (begins($file, $codehome)) {
            $from_codehome = true;
            $n = strlen($codehome);
        } else {
            backtrace(false);
            echo "{$file} doesn't begin with " . ZESK_ROOT . " or " . $codehome . "\n";
            exit(1);
        }
    }
    $file = substr($file, $n);
    $n = substr_count($dest_file, "/", $n);
    $ndirnames = "dirname(__FILE__)";
    for ($i = 0; $i < $n; $i++) {
        $ndirnames = "dirname(" . $ndirnames . ")";
    }
    $contents = array();
    $contents[] = "#!/usr/bin/env php";
    $contents[] = "<" . "?php";
    $contents[] = "/**";
    $contents[] = " * @version \$URL\$";
    $contents[] = " * @package zesk";
    $contents[] = " * @subpackage test";
    $contents[] = " * @author \$Author\$";
    $contents[] = " * @copyright Copyright &copy; " . date('Y') . ", Market Acumen, Inc.";
    $contents[] = " */";
    if (!$from_codehome) {
        $contents[] = "if (!defined('ZESK_ROOT')) define('ZESK_ROOT', " . $ndirnames . ".'/');";
        $contents[] = "require_once ZESK_ROOT . 'zesk.inc';";
    } else {
        $contents[] = "if (!defined('CODEHOME')) define('CODEHOME', " . $ndirnames . ".'/');";
        $contents[] = "require_once CODEHOME . 'zesk/zesk.inc';";
    }
    $contents[] = "Test_Unit::init();";
    $contents[] = "";
    if ($do_include) {
        if (!$from_codehome) {
            $contents[] = "require_once ZESK_ROOT . '{$file}';";
        } else {
            $contents[] = "require_once CODEHOME . '{$file}';";
        }
        $contents[] = "";
    }
    return $contents;
}
开发者ID:zesk,项目名称:zesk,代码行数:52,代码来源:zesk-generate-tests.php


示例9: execute

 function execute(&$observer)
 {
     if (SC::isEmpty('board_config.econ_disabled')) {
         return TRUE;
     }
     $observer->set('error.code', GENERAL_MESSAGE);
     $observer->set('error.title', 'Econ Disabled');
     $observer->set('error.message', 'The economy of gaia is currently disabled.');
     $observer->set('error.line', __LINE__);
     $observer->set('error.file', __FILE__);
     $observer->set('error.debug', backtrace());
     return FALSE;
 }
开发者ID:GeniusXalid,项目名称:php-mvc,代码行数:13,代码来源:econenabled.model.php


示例10: execute

 /**
  * Execute the model
  * @param Container    The Observer object.
  * @return bool        TRUE if successful, else FALSE.
  * @access public
  */
 function execute(&$observer)
 {
     if (SC::isEmpty('board_config.inventory_disable')) {
         return TRUE;
     }
     $observer->set('error.code', GENERAL_MESSAGE);
     $observer->set('error.title', 'Profile Disabled');
     $observer->set('error.message', 'The profile section of the site is currently disabled.');
     $observer->set('error.line', __LINE__);
     $observer->set('error.file', __FILE__);
     $observer->set('error.debug', backtrace());
     return FALSE;
 }
开发者ID:GeniusXalid,项目名称:php-mvc,代码行数:19,代码来源:inventoryenabled.model.php


示例11: execute

 /**
  * Execute the model
  * @param Container    The Observer object.
  * @return bool        TRUE if successful, else FALSE.
  * @access public
  */
 function execute(&$observer)
 {
     $flux =& FluxCapacitor::create('agent.checkserverloadavg');
     $rs =& $flux->execute();
     if ($rs->isSuccess()) {
         return TRUE;
     }
     $observer->set('error.code', GENERAL_ERROR);
     $observer->set('error.title', 'Server Overload');
     $observer->set('error.message', 'Server is busy due to heavy traffic.<BR/>Please try again in 5 minutes');
     $observer->set('error.line', __LINE__);
     $observer->set('error.file', __FILE__);
     $observer->set('error.debug', backtrace());
     return FALSE;
 }
开发者ID:GeniusXalid,项目名称:php-mvc,代码行数:21,代码来源:checkserverloadavg.model.php


示例12: bail

function bail($msg = '')
{
    if (is_array($msg)) {
        $msg = array_dump($msg);
    }
    $html = '';
    $html .= '
				<h2 style="margin-bottom:2px;">ERROR MESSAGE</h2>' . $msg . '<br>
				<h2 style="margin-bottom:6px;">BACKTRACE</h2>
				' . backtrace() . '
				';
    echo $html;
    trigger_error(strip_tags($msg));
    exit;
}
开发者ID:radicaldesigns,项目名称:jaguar,代码行数:15,代码来源:utility.php


示例13: execute

 /**
  * Execute the model
  * @param Container    The Observer object.
  * @return bool        TRUE if successful, else FALSE.
  * @access public
  */
 function execute(&$observer)
 {
     $flux = FluxCapacitor::create('agent.checkboardconfigvar');
     $flux->checkVarNames('avatar_save_disable');
     $rs = $flux->execute();
     $vars = $rs->getVariables();
     if (intval($vars['avatar_save_disable']) == 0) {
         return TRUE;
     }
     $observer->set('error.code', GENERAL_MESSAGE);
     $observer->set('error.title', 'Save Disabled');
     $observer->set('error.message', 'Avatar saving is currently disabled.');
     $observer->set('error.line', __LINE__);
     $observer->set('error.file', __FILE__);
     $observer->set('error.debug', backtrace());
     return FALSE;
 }
开发者ID:GeniusXalid,项目名称:php-mvc,代码行数:23,代码来源:avatarsaveenabled.model.php


示例14: Template

 function Template($viewroot, $filename) {       // the constructor function
  if ($filename=="") {
   echo "Wrong declaration of new Template. Backtrace:<br>";
   echo backtrace();
   return;
  }
  $this->viewroot = $viewroot."/templates/";
  $this->filename=$this->viewroot.$filename;
  if (is_file($this->filename)) {                                       // load template from file
   $this->template = filestr($this->filename);
   $this->srctemplate = $this->template;
   $this->is_template = 1;
  } else {
   $this->template = $filename ;                                        // if this is not a file - load as raw data
   $this->srctemplate = $this->template;
   $this->is_template = 0;
  }
 }
开发者ID:serega011,项目名称:izumrud,代码行数:18,代码来源:Template.1.88.php


示例15: error_handler

function error_handler($errno, $errmsg, $filename, $linenum)
{
    $dt = date("Y-m-d H:i:s (T)");
    $errortype = array(E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parse 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");
    // set of errors for which a var trace will be saved
    //$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
    $output = <<<EOT
<style type="text/css">
<!-- 
    .red_bold {color:red; font-weight:bold;}
    .error { border: 1px solid grey; color: #000000;}
    .error p.errmsg { font-size: 1em;  background-color: #990033; color: white; margin: 0 0 0 0;}
    .error p.errfile { font-size: .8em; font-style: italic; margin: 0 0 0 20px;}
    .error table.backtrace { }
    .error table.backtrace th { text-align: left; background-color: #339900; color: white}
    .error table.backtrace td {  color: #000000; background-color: #E8E8E8;}
    .error table.backtrace span.function { font-weight: bold; }
    .error table.backtrace span.file { font-size: .8em; font-style: italic; }
    .error table.backtrace span.args { color: #000000; }
-->
</style>
EOT;
    $output .= "<div class=\"error\">";
    $output .= "<p class=\"errmsg\">{$errortype[$errno]} : {$errmsg}</p>\n";
    $output .= "<p class=\"errfile\">in file {$filename} : {$linenum}</p>\n";
    $output .= backtrace();
    $output .= "</div>";
    echo $output;
    // save to the error log, and e-mail it if there is a critical user error
    /*
    error_log($err, 3, "/error.log");
    if ($errno == E_USER_ERROR) {
    mail("[email protected]", "Critical User Error", $err);
    }
    */
}
开发者ID:jwest00724,项目名称:mambo,代码行数:36,代码来源:phpgettext.includes.php


示例16: includes_info

 function includes_info()
 {
     backtrace(get_included_files(), 'e', 'Include files');
 }
开发者ID:platform-project,项目名称:platform-project,代码行数:4,代码来源:debug.php


示例17: normalizeType

 /**
  * @param string $type
  *
  * @return string
  */
 protected function normalizeType(string $type) : string
 {
     $type = ltrim($type, '\\');
     foreach (self::module()->namespaces as $name => $namespace) {
         if (strpos($type, $namespace->getClassNamespace()) !== false) {
             return $name . substr($type, strlen($namespace->getClassNamespace()) + 1);
         }
     }
     backtrace();
     return null;
 }
开发者ID:cawaphp,项目名称:module-swagger-server,代码行数:16,代码来源:ToolsTrait.php


示例18: errorHandlerLogged

function errorHandlerLogged($errno, $errstr, $errfile, $errline)
{
    global $errorLog, $_errors;
    switch ($errno) {
        case PM_FATAL:
            if (isset($_errors)) {
                $_errors .= '<hr noshade size=1 width=100%>';
            }
            echo "<div style=\"border: 1 solid #A0A0A0; background-color: #FFFDA0; padding: 5px;\">\n              {$_errors}<dt><b><span style='color:red'>Fatal error </span></b> at {$errfile}:{$errline}</dt>\n              <dd>Description: {$errstr}</dd></div>\n";
            $errorLog->writeLine($errno, $errstr, $errfile, backtrace());
            exit - 1;
        case PM_ERROR:
            $_errors .= "<dt>Error at {$errfile}:{$errline}</dt><dd>Description: {$errstr}</dd>\n";
            $errorLog->writeLine($errno, 'Error: ' . $errstr, $errfile, backtrace());
            break;
        case PM_WARNING:
            $_errors .= "<dt>Warning at {$errfile}:{$errline}</dt><dd>Description: {$errstr}</dd>\n";
            $errorLog->writeLine($errno, 'Warning: ' . $errstr, $errfile, $errline);
            break;
        default:
            if (strpos($errstr, 'Deprecated') === false) {
                $errors .= "<dt>PHP error at {$errfile}:{$errline}</dt><dd>Description: {$errstr}</dd>\n";
                $errorLog->writeLine($errno, 'PHP error: ' . $errstr, $errfile, $errline);
            }
            break;
    }
}
开发者ID:pankajit,项目名称:carumba,代码行数:27,代码来源:_kernel.bak.php


示例19: errhandler

function errhandler($type, $msg, $file, $line, $context)
{
    #print "---------------------.";
    #print_r($GLOBALS['backtrace_printed_a_lot']); # just for debugging the reminder-var
    #print ".---------------------";
    switch ($type) {
        case E_ERROR:
        case E_USER_ERROR:
            # php4
            backtrace(false, "ERROR:", $msg, true);
            # DO NOT DISABLE THIS LINE
            break;
        case E_WARNING:
        case E_USER_WARNING:
            # php4
            backtrace(false, "WARNING:", $msg, true);
            # Think before disabling this one
            break;
        case E_NOTICE:
        case E_USER_NOTICE:
            # php4
            # this might be annoying, but usually indicates non-fatal errors...
            backtrace(false, "INFO:", $msg, false);
            print "<b>Hint:</b> use the @ symbol in front of function or brackets to suppress unavoidable errors.<br>";
            break;
        default:
            backtrace(false, "TYPE " . $type . ":", $msg, false);
            print "<b>Hint:</b> lookup the errorcode <a target=_new href='http://php.net/manual/en/ref.errorfunc.php#errorfunc.constants'> HERE </a><br>";
            break;
    }
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:31,代码来源:debugging.php


示例20: die_quietly

/**
 * Clean replacement for die(), outputs a message with debugging info if needed and ends output
 *
 * @param string $text Text to display on error page
 * @param string $title Title to place on web page
 * @param string $file Filename to display
 * @param string $line Line in file to display
 * @param string $sql Any SQL text to display
 */
function die_quietly($text = '', $title = 'Message', $file = '', $line = '', $sql = '')
{
    global $roster;
    if ($roster->pages[0] == 'ajax') {
        ajax_die($text, $title, $file, $line, $sql);
    }
    // die_quitely died quietly
    if (defined('ROSTER_DIED')) {
        echo "<pre>The quiet die function suffered a fatal error. Die information below\n";
        echo "First die data:\n";
        print_r($GLOBALS['die_data']);
        echo "\nSecond die data:\n";
        print_r(func_get_args());
        if (!empty($roster->error->report)) {
            echo "\nPHP Notices/Warnings:\n";
            print_r($roster->error->report);
        }
        exit;
    }
    define('ROSTER_DIED', true);
    $GLOBALS['die_data'] = func_get_args();
    $roster->output['title'] = $title;
    if (!defined('ROSTER_HEADER_INC') && is_array($roster->config)) {
        include_once ROSTER_BASE . 'header.php';
    }
    if (!defined('ROSTER_MENU_INC') && is_array($roster->config)) {
        $roster_menu = new RosterMenu();
        $roster_menu->makeMenu($roster->output['show_menu']);
    }
    if (is_object($roster->db)) {
        $roster->db->close_db();
    }
    echo border('sred', 'start', $title) . '<table class="bodyline" cellspacing="0" cellpadding="0">' . "\n";
    if (!empty($text)) {
        echo "<tr>\n<td class=\"membersRowRight1\" style=\"white-space:normal;\"><div align=\"center\">{$text}</div></td>\n</tr>\n";
    }
    if (!empty($sql)) {
        echo "<tr>\n<td class=\"membersRowRight1\" style=\"white-space:normal;\">SQL:<br />" . sql_highlight($sql) . "</td>\n</tr>\n";
    }
    if (!empty($file)) {
        $file = str_replace(ROSTER_BASE, '', $file);
        echo "<tr>\n<td class=\"membersRowRight1\">File: {$file}</td>\n</tr>\n";
    }
    if (!empty($line)) {
        echo "<tr>\n<td class=\"membersRowRight1\">Line: {$line}</td>\n</tr>\n";
    }
    if ($roster->config['debug_mode'] == 2) {
        echo "<tr>\n<td class=\"membersRowRight1\" style=\"white-space:normal;\">";
        echo backtrace();
        echo "</td>\n</tr>\n";
    }
    echo "</table>\n" . border('sred', 'end');
    if (!defined('ROSTER_FOOTER_INC') && is_array($roster->config)) {
        include_once ROSTER_BASE . 'footer.php';
    }
    exit;
}
开发者ID:reddragon010,项目名称:wowroster-rge,代码行数:66,代码来源:functions.lib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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