CodeIgniter 用户指南 版本 2.0.0

PHP100中文网
查看原文

评测你的应用程序

该分析器将在页面下方显示基准测试结果,运行过的 SQL 语句,以及 $_POST 数据。这些信息有助于开发过程中的调试和优化。

初始化类

注意:  此分析器无须手动初始化.如果已按照下面的方式激活,他将被输出类自动装载。

激活分析器

控制器中设置以下方法以激活该分析器

$this->output->enable_profiler(TRUE);

分析器激活后将产生一个报告并插入您的页面底部

使用以下方法禁用该分析器:

$this->output->enable_profiler(FALSE);

设定基准点

为了让该分析器编译和显示你的测试数据,你必须使用特定的语法命名基准点。

请在基准测试类部分阅读关于设置基准点的资料。

Enabling and Disabling Profiler Sections

Each section of Profiler data can be enabled or disabled by setting a corresponding config variable to TRUE or FALSE. This can be done one of two ways. First, you can set application wide defaults with the application/config/profiler.php config file.

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

In your controllers, you can override the defaults and config file values by calling the set_profiler_sections() method of the Output class:

$sections = array(
    'config'  => TRUE,
    'queries' => TRUE
    );

$this->output->set_profiler_sections($sections);

Available sections and the array key used to access them are described in the table below.

Key Description Default
benchmarks Elapsed time of Benchmark points and total execution time TRUE
config CodeIgniter Config variables TRUE
controller_info The Controller class and method requested TRUE
get Any GET data passed in the request TRUE
http_headers The HTTP headers for the current request TRUE
memory_usage Amount of memory consumed by the current request, in bytes TRUE
post Any POST data passed in the request TRUE
queries Listing of all database queries executed, including execution time TRUE
uri_string The URI of the current request TRUE

 

翻译贡献者: chouqiuqiu, Hex, teamoustar
最后修改: 2011-01-31 18:58:27