1
我正在努力启用CodeIgniter中的分析器。我已经将它添加到$libraries
配置数组中,所以它应该被自动加载。但我得到的错误...使用CodeIngniter Profiler
Fatal error: Call to a member function enable_profiler() on a non-object in C:\......\application\core\publiccontroller.php on line 6
我的代码是:
<?php
class PublicController extends CI_Controller {
public function __construct() {
// enable profiler for development
if (ENVIRONMENT == 'development') {
$this->output->enable_profiler(true);
}
}
}
?>
autoload.php
具有....
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/
$autoload['libraries'] = array('profiler');
我在做什么错?我正在使用CI版本2
这是完全正确的,需要在调用它的方法之前构造父类CI_Controller。 @Webnet,你不需要加载分析器:它不是一个库,它是总是加载的Output类的一部分。 – 2011-04-27 04:49:56
Doh!史诗般的失败,谢谢! – Webnet 2011-04-27 13:28:04
@Webnet我知道这个的原因是因为我在CI模型中工作的问题多于我的* headdesks *。 – cwallenpoole 2011-04-27 14:40:05