Example #1
0
/**
 * 快速打印数据(网页模式)
 *
 * @param mix $mix_target
 * @param bool $bool_isBreakPoint 开启则打印完成后停止程序执行
 * @return null
 */
function P_web($mix_target, $bool_isBreakPoint = false, $return = false)
{
    static $_pcount;
    $lable = $return ? $_pcount : ++$_pcount;
    if (is_array($mix_target)) {
        foreach ($mix_target as $k => $v) {
            if (is_bool($v)) {
                $mix_target[$k] = $v == true ? '(bool)true' : '(bool)false';
            }
            if ($v === null) {
                $mix_target[$k] = '(null)';
            }
            if (is_array($v)) {
                $mix_target[$k] = p_web($v, false, true);
            }
        }
    }
    $result = '';
    if (is_bool($mix_target)) {
        $result = $mix_target == true ? '(bool)true' : '(bool)false';
    }
    if ($mix_target === null) {
        $result = '(null)';
    }
    if ($return) {
        return $mix_target;
    }
    $output = htmlspecialchars(print_r($mix_target, TRUE), ENT_QUOTES);
    $debug = debug_backtrace();
    $debug_mode = false;
    if (AXION_CONFIG::get('axion.debug.level') > 0) {
        $debug_mode = '(Debug Mode ON)';
    }
    $str = '<pre>';
    if ($lable) {
        $str .= 'Debug Lable:<strong>' . $lable . $debug_mode . '</strong><br/>';
    }
    $str .= 'In <strong>' . $debug[1]['file'] . '</strong> @Line <strong>' . $debug[1]['line'] . '</strong><BR/>';
    $str .= $output . $result;
    $str .= '</pre>';
    if ($bool_isBreakPoint) {
        exit($str);
    }
    if (IS_FIREPHP && AXION_CONFIG::get('axion.debug.usefirephp')) {
        $str = strip_tags($str);
        AXION_UTIL_FIREPHP::getInstance(true)->info($str, '打印数据');
    } else {
        echo $str;
    }
    return;
}
Example #2
0
 /**
  * Creates FirePHP object and stores it for singleton access
  *
  * @return AXION_UTIL_FIREPHP
  */
 public static function init()
 {
     return self::$instance = new self();
 }
Example #3
0
 public function applicationTeminated()
 {
     $runtime = AXION_UTIL::excuteTime();
     $memUseage = number_format(memory_get_usage() / 1024) . 'k';
     Axion_log::log('程序执行时间:' . $runtime);
     Axion_log::log('本次内存使用:' . $memUseage);
     $logs = Axion_log::getLogPool();
     if (Axion_log::isOverLimit()) {
         array_shift($logs);
         $warningMessage = "超过日志容量限制(" . axion_log::getPoolLimit() . "),日志系统将自头删除数据保障程序工作";
         $warning = array('int_lv' => axion_log::WARNING, 'str_msg' => $warningMessage);
         array_unshift($logs, $warning);
     }
     if (IS_FIREPHP && AXION_CONFIG::get('axion.debug.usefirephp')) {
         $fb = AXION_UTIL_FIREPHP::getInstance(true);
         foreach ($logs as $v) {
             switch ($v['int_lv']) {
                 case Axion_log::WARNING:
                     $fb->warn($v['str_msg']);
                     break;
                 case Axion_log::NOTICE:
                     $fb->info($v['str_msg']);
                     break;
                 case Axion_log::ERROR:
                     $fb->error($v['str_msg']);
                     break;
                 case Axion_log::INFO:
                     $fb->log($v['str_msg']);
                     break;
             }
         }
     } else {
         P($logs);
     }
 }