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


PHP Kohana_Exception::debug_path方法代码示例

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


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

示例1: _dump

 /**
  * Helper for Kohana_Exception::dump(), handles recursion in arrays and objects.
  *
  * @param   mixed    variable to dump
  * @param   integer  maximum length of strings
  * @param   integer  recursion level (internal)
  * @return  string
  */
 private static function _dump(&$var, $length = 128, $level = 0)
 {
     if ($var === NULL) {
         return '<small>NULL</small>';
     } elseif (is_bool($var)) {
         return '<small>bool</small> ' . ($var ? 'TRUE' : 'FALSE');
     } elseif (is_float($var)) {
         return '<small>float</small> ' . $var;
     } elseif (is_resource($var)) {
         if (($type = get_resource_type($var)) === 'stream' and $meta = stream_get_meta_data($var)) {
             $meta = stream_get_meta_data($var);
             if (isset($meta['uri'])) {
                 $file = $meta['uri'];
                 if (function_exists('stream_is_local')) {
                     // Only exists on PHP >= 5.2.4
                     if (stream_is_local($file)) {
                         $file = Kohana_Exception::debug_path($file);
                     }
                 }
                 return '<small>resource</small><span>(' . $type . ')</span> ' . htmlspecialchars($file, ENT_NOQUOTES, Kohana::CHARSET);
             }
         } else {
             return '<small>resource</small><span>(' . $type . ')</span>';
         }
     } elseif (is_string($var)) {
         if (strlen($var) > $length) {
             // Encode the truncated string
             $str = htmlspecialchars(substr($var, 0, $length), ENT_NOQUOTES, Kohana::CHARSET) . '&nbsp;&hellip;';
         } else {
             // Encode the string
             $str = htmlspecialchars($var, ENT_NOQUOTES, Kohana::CHARSET);
         }
         return '<small>string</small><span>(' . strlen($var) . ')</span> "' . $str . '"';
     } elseif (is_array($var)) {
         $output = array();
         // Indentation for this variable
         $space = str_repeat($s = '    ', $level);
         static $marker;
         if ($marker === NULL) {
             // Make a unique marker
             $marker = uniqid("");
         }
         if (empty($var)) {
             // Do nothing
         } elseif (isset($var[$marker])) {
             $output[] = "(\n{$space}{$s}*RECURSION*\n{$space})";
         } elseif ($level < 5) {
             $output[] = "<span>(";
             $var[$marker] = TRUE;
             foreach ($var as $key => &$val) {
                 if ($key === $marker) {
                     continue;
                 }
                 if (!is_int($key)) {
                     $key = '"' . $key . '"';
                 }
                 $output[] = "{$space}{$s}{$key} => " . (strpos($key, '"pass') === 0 ? '<small>hidden</small>' : Kohana_Exception::_dump($val, $length, $level + 1));
             }
             unset($var[$marker]);
             $output[] = "{$space})</span>";
         } else {
             // Depth too great
             $output[] = "(\n{$space}{$s}...\n{$space})";
         }
         return '<small>array</small><span>(' . count($var) . ')</span> ' . implode("\n", $output);
     } elseif (is_object($var)) {
         // Copy the object as an array
         $array = (array) $var;
         $output = array();
         // Indentation for this variable
         $space = str_repeat($s = '    ', $level);
         $hash = spl_object_hash($var);
         // Objects that are being dumped
         static $objects = array();
         if (empty($var)) {
             // Do nothing
         } elseif (isset($objects[$hash])) {
             $output[] = "{\n{$space}{$s}*RECURSION*\n{$space}}";
         } elseif ($level < 5) {
             $output[] = "<code>{";
             $objects[$hash] = TRUE;
             foreach ($array as $key => &$val) {
                 if ($key[0] === "") {
                     // Determine if the access is private or protected
                     $access = '<small>' . ($key[1] === '*' ? 'protected' : 'private') . '</small>';
                     // Remove the access level from the variable name
                     $key = substr($key, strrpos($key, "") + 1);
                 } else {
                     $access = '<small>public</small>';
                 }
                 $output[] = "{$space}{$s}{$access} {$key} => " . Kohana_Exception::_dump($val, $length, $level + 1);
             }
//.........这里部分代码省略.........
开发者ID:anqqa,项目名称:Anqh,代码行数:101,代码来源:Kohana_Exception.php

示例2: count

</a>(<?php 
echo count($included);
?>
)</h3>
          <div id="<?php 
echo $env_id;
?>
" class="collapsed">
            <table cellspacing="0">
              <?php 
foreach ($included as $file) {
    ?>
              <tr>
                <td>
                  <pre><?php 
    echo Kohana_Exception::debug_path($file);
    ?>
</pre>
                </td>
              </tr>
              <?php 
}
?>
            </table>
          </div>
          <?php 
foreach (array("_SESSION", "_GET", "_POST", "_FILES", "_COOKIE", "_SERVER") as $var) {
    ?>
          <?php 
    if (empty($GLOBALS[$var]) or !is_array($GLOBALS[$var])) {
        continue;
开发者ID:JasonWiki,项目名称:docs,代码行数:31,代码来源:error_admin.html.php


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