示例#1
0
文件: debug.php 项目: jonlb/JxCMS
 public static function dump($variable, $label = NULL, $type = 'log')
 {
     if (class_exists('Fire')) {
         switch ($type) {
             case 'info':
                 Fire::info($variable, $label);
                 break;
             case 'log':
                 Fire::log($variable, $label);
                 break;
             case 'warn':
                 Fire::warn($variable, $label);
                 break;
             case 'error':
                 Fire::error($variable, $label);
                 break;
             case 'dump':
                 Fire::dump($variable, $label);
                 break;
         }
     } else {
         if (isset($label)) {
             echo $label . ":";
         }
         echo "<br><pre>";
         var_dump($variable);
         echo "</pre><br>";
     }
 }
Kohana::$log->add('FirePHP::GROUP_START', 'Kohana FirePHP Demos...');
Kohana::$log->add('FirePHP::LOG', 'FirePHP Log...');
Kohana::$log->add('FirePHP::INFO', 'FirePHP Info...');
Kohana::$log->add('FirePHP::WARN', 'FirePHP Warn...');
Kohana::$log->add('FirePHP::ERROR', 'FirePHP Error...');
$demo = array('label' => 'FirePHP Table...', 'table' => array(array('Col 1 Heading', 'Col 2 Heading'), array('Row 1 Col 1', 'Row 1 Col 2'), array('Row 2 Col 1', 'Row 2 Col 2'), array('Row 3 Col 1', 'Row 3 Col 2')));
Kohana::$log->add('FirePHP::LOG', array('label' => 'Passing objects to log...', 'object' => $demo));
Kohana::$log->add('FirePHP::TABLE', $demo);
Kohana::$log->add('FirePHP::LOG', 'FirePHP Log...');
// Not sure what dump does... ???
Kohana::$log->add('FirePHP::DUMP', array('key' => 2, 'variable' => $demo));
Kohana::$log->add('FirePHP::TRACE', 'FirePHP Trace...');
Kohana::$log->add('FirePHP::GROUP_END', '')->write();
// However, its much easier to just do this...
// All FirePHP commands are available, plus a few new ones...
Fire::log('Hi Mom!');
Fire::group('My Group')->warn('Warning!')->groupEnd();
Fire::error('UH OH! Now, look what you did it!');
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'welcome', 'action' => 'index'));
/**
 * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
 * If no source is specified, the URI will be automatically detected.
 */
echo Request::instance()->execute()->send_headers()->response;
/**
 * Run the at the end of the bootstap to profile the entire application
 * Alternatively, you can extend one of the FirePHP Controllers