CodeIgniter调试功能:如何显示/调试控制器中任何变量的格式化值?

Is there any built-in debug function for codeigniter to use in controller?

In cakephp there is debug($variable) that one can use in controller.

I can use var_dump($variable); or print_r($variable);

But is there any built-in debug function for codeigniter to use in controller to get formatted result of any variable?

The way I usually handle this is wherever I want to debug a variable.

...
echo "<pre>";
die(print_r($var, TRUE));
...

This gives you a nicely formatted version of your variable contents because it retains the formatting when inside of the <pre> tag.

So instead of

Array ( [0] => "value zero" [1] => "value 1" )

you get

Array 
(
    [0] => "value zero"
    [1] => "value one"
)

etc...

Not sure how much more formatted you can get, unless you're looking for color schemes and animations in your debug statements.