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


PHP backtrace函数代码示例

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


在下文中一共展示了backtrace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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("phpdev@example.com", "Critical User Error", $err);
    }
    */
}
开发者ID:jwest00724,项目名称:mambo,代码行数:36,代码来源:phpgettext.includes.php


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