CodeIgniterのProfilerが便利

CodeIgniterの便利な機能を発見した。

実行時のクエリや処理時間をページに出力してくれるProfiler。

CodeIgniterのProfiler出力例

コントローラークラスの中で次の一行を書くだけで、初期化と実行にかかった時間、POSTデータ、発行されたSQLクエリをページの最後に出力してくれる。

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

これを含めたコントローラーはたとえばこんな感じ。

class BingoBongo extends Controller{
	function BingoBongo(){
		parent::Controller();
	}

	function index(){
		$this->output->enable_profiler(true);
		//..残りの処理
	}
}

こういう機能がストレスなく使えるとテストとデバッグが大変楽になるのでありがたい。

Categories: HowTo's, Tips and Tricks |Tagged , , , | Trackback URL |