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


PHP Kohana::debug_source方法代码示例

本文整理汇总了PHP中Kohana::debug_source方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::debug_source方法的具体用法?PHP Kohana::debug_source怎么用?PHP Kohana::debug_source使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kohana的用法示例。


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

示例1: assert

 public function assert($desc, $condition)
 {
     if ($condition) {
         echo $desc . ' <span class="pass">OK</span><br/>';
     } else {
         echo $desc . ' <span class="fail">FAIL</span><br/>';
         $this->teardown();
         $bt = debug_backtrace();
         $bt = array_shift($bt);
         echo "<hr/><b>{$bt['file']}: ({$bt['line']})</b><br/>";
         echo Kohana::debug_source($bt['file'], $bt['line']);
         $this->after(TRUE);
         exit;
     }
 }
开发者ID:andygoo,项目名称:mongodb-php-odm,代码行数:15,代码来源:mongotest.php

示例2:

echo html::chars($message);
?>
</span></h1>
	<div id="<?php 
echo $error_id;
?>
" class="content">
		<p><span class="file"><?php 
echo Kohana::debug_path($file);
?>
 [ <?php 
echo $line;
?>
 ]</span></p>
		<?php 
echo Kohana::debug_source($file, $line);
?>
		<ol class="trace">
		<?php 
foreach (Kohana::trace($trace) as $i => $step) {
    ?>
			<li>
				<p>
					<span class="file">
						<?php 
    if ($step['file']) {
        $source_id = $error_id . 'source' . $i;
        ?>
							<a href="#<?php 
        echo $source_id;
        ?>
开发者ID:schelmo,项目名称:core,代码行数:31,代码来源:error.php

示例3: trace

 /**
  * Returns an array of HTML strings that represent each step in the backtrace.
  *
  *     // Displays the entire current backtrace
  *     echo implode('<br/>', Kohana::trace());
  *
  * @param   string  path to debug
  * @return  string
  */
 public static function trace(array $trace = NULL)
 {
     if ($trace === NULL) {
         // Start a new trace
         $trace = debug_backtrace();
     }
     // Non-standard function calls
     $statements = array('include', 'include_once', 'require', 'require_once');
     $output = array();
     foreach ($trace as $step) {
         if (!isset($step['function'])) {
             // Invalid trace step
             continue;
         }
         if (isset($step['file']) and isset($step['line'])) {
             // Include the source of this step
             $source = Kohana::debug_source($step['file'], $step['line']);
         }
         if (isset($step['file'])) {
             $file = $step['file'];
             if (isset($step['line'])) {
                 $line = $step['line'];
             }
         }
         // function()
         $function = $step['function'];
         if (in_array($step['function'], $statements)) {
             if (empty($step['args'])) {
                 // No arguments
                 $args = array();
             } else {
                 // Sanitize the file path
                 $args = array($step['args'][0]);
             }
         } elseif (isset($step['args'])) {
             if (!function_exists($step['function']) or strpos($step['function'], '{closure}') !== FALSE) {
                 // Introspection on closures or language constructs in a stack trace is impossible
                 $params = NULL;
             } else {
                 if (isset($step['class'])) {
                     if (method_exists($step['class'], $step['function'])) {
                         $reflection = new ReflectionMethod($step['class'], $step['function']);
                     } else {
                         $reflection = new ReflectionMethod($step['class'], '__call');
                     }
                 } else {
                     $reflection = new ReflectionFunction($step['function']);
                 }
                 // Get the function parameters
                 $params = $reflection->getParameters();
             }
             $args = array();
             foreach ($step['args'] as $i => $arg) {
                 if (isset($params[$i])) {
                     // Assign the argument by the parameter name
                     $args[$params[$i]->name] = $arg;
                 } else {
                     // Assign the argument by number
                     $args[$i] = $arg;
                 }
             }
         }
         if (isset($step['class'])) {
             // Class->method() or Class::method()
             $function = $step['class'] . $step['type'] . $step['function'];
         }
         $output[] = array('function' => $function, 'args' => isset($args) ? $args : NULL, 'file' => isset($file) ? $file : NULL, 'line' => isset($line) ? $line : NULL, 'source' => isset($source) ? $source : NULL);
         unset($function, $args, $file, $line, $source);
     }
     return $output;
 }
开发者ID:abdul-baten,项目名称:hbcms,代码行数:80,代码来源:core.php

示例4: __

                echo __('Error');
                ?>
</strong><br/>
							<p><?php 
                echo $result->getMessage();
                ?>
</p>
							<div><?php 
                echo Kohana::debug_path($result->getFile());
                ?>
 [ <?php 
                echo $result->getLine();
                ?>
 ]</div>
							<pre class="source"><code><?php 
                echo Kohana::debug_source($result->getFile(), $result->getLine());
                ?>
</code></pre>
						</td>

					<?php 
            }
            ?>

				</tr>

			<?php 
        }
        ?>

		<?php 
开发者ID:banks,项目名称:unittest,代码行数:31,代码来源:html.php


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