【问题标题】:CodeIgniter output to profilerCodeIgniter 输出到分析器
【发布时间】:2011-02-11 15:29:14
【问题描述】:

是否可以将自定义数据输出到 CI 分析器?

我试过了

$this->output->append_output($var); 

但这似乎类似于回声,因为它出现在页面顶部。

有没有办法让它与其余的分析信息一起出现?

【问题讨论】:

    标签: codeigniter


    【解决方案1】:

    扩展分析器类:

    class MY_Profiler extends CI_Profiler {
    
        function _do_stuff() {
            //do stuff
        }
    
        //In the run method add your method
        function run() {
            $this->_do_stuff();
        }
    
    }
    

    这是我博客中的内容:http://pinoytech.org/blog/post/Add-SESSIONS-to-Profiler-in-CodeIgniter

    【讨论】:

      【解决方案2】:

      您可以通过两种方式设置要显示的部分

      1.将此添加到您要分析的控制器方法中:

      $sections = array(
      'config'  => TRUE,
      'queries' => TRUE
      );
      
      $this->output->set_profiler_sections($sections);
      $this->output->enable_profiler(TRUE);
      

      2.在 application/config/profiler.php 中设置应用程序范围的默认值:

      $config['config'] = FALSE;
      $config['queries'] = FALSE;
      

      这里是所有可用部分的列表:(顺便说一下,这可以在 system/libraries/profiler.php 下找到

      'benchmarks',
      'get',
      'memory_usage',
      'post',
      'uri_string',
      'controller_info',
      'queries',
      'http_headers',
      'session_data',
      'config'
      

      【讨论】:

        猜你喜欢
        • 2019-01-14
        • 1970-01-01
        • 1970-01-01
        • 2011-12-29
        • 1970-01-01
        • 2023-01-18
        • 2012-08-18
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多