CodeIgniter执行时间基准测试无法正常运行

时间:2014-01-26 08:41:00

标签: php codeigniter

这是我的控制器:

class Pages extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->database();
    }

    public function index()
    {
        $data['title'] = 'Home Page';
        $this->load->view('templates/header',$data);
        $this->load->view('pages/home',$data);
        $this->load->view('templates/footer');
    }
}

这是我的footer.php文件,可在相应的文件夹中找到:

        <p class='footer'>Page generated in {elapsed_time} seconds.</p>
    </body>
</html>

我也尝试使用<?php echo $this->benchmark->elapsed_time(); ?>代替{elapsed_time},但这两种方法都只是在我的页面上输出以下内容:

“在{elapsed_time}秒内生成的页面。”

从本质上讲,我实际上并没有得到任何时间。我打开了探查器进行检查,它肯定是在那里正确计算经过的时间。我只是没有得到我的观点。 :\发生了什么事?

编辑:这是我运行日志级别4的结果 -

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>

DEBUG - 2014-01-26 10:14:01 --> Config Class Initialized
DEBUG - 2014-01-26 10:14:01 --> Hooks Class Initialized
DEBUG - 2014-01-26 10:14:01 --> Utf8 Class Initialized
DEBUG - 2014-01-26 10:14:01 --> UTF-8 Support Enabled
DEBUG - 2014-01-26 10:14:01 --> URI Class Initialized
DEBUG - 2014-01-26 10:14:01 --> Router Class Initialized
DEBUG - 2014-01-26 10:14:01 --> No URI present. Default controller set.
DEBUG - 2014-01-26 10:14:01 --> Output Class Initialized
DEBUG - 2014-01-26 10:14:01 --> Security Class Initialized
DEBUG - 2014-01-26 10:14:02 --> Input Class Initialized
DEBUG - 2014-01-26 10:14:02 --> Global POST and COOKIE data sanitized
DEBUG - 2014-01-26 10:14:02 --> Language Class Initialized
DEBUG - 2014-01-26 10:14:02 --> Loader Class Initialized
DEBUG - 2014-01-26 10:14:02 --> Helper loaded: url_helper
DEBUG - 2014-01-26 10:14:02 --> Session Class Initialized
DEBUG - 2014-01-26 10:14:02 --> Helper loaded: string_helper
DEBUG - 2014-01-26 10:14:02 --> A session cookie was not found.
DEBUG - 2014-01-26 10:14:02 --> Session routines successfully run
DEBUG - 2014-01-26 10:14:02 --> Controller Class Initialized
DEBUG - 2014-01-26 10:14:02 --> Database Driver Class Initialized
DEBUG - 2014-01-26 11:14:02 --> File loaded: ../application/views/templates/header.php
DEBUG - 2014-01-26 11:14:02 --> File loaded: ../application/views/pages/home.php
DEBUG - 2014-01-26 11:14:02 --> File loaded: ../application/views/templates/footer.php
DEBUG - 2014-01-26 11:14:02 --> Final output sent to browser
DEBUG - 2014-01-26 11:14:02 --> Total execution time: 0.0236

1 个答案:

答案 0 :(得分:-1)

修正了 - 问题在于我使用了输出缓冲,我忘了在页脚中删除它。