Cakephp debug variable value

How can I print some kind of debug output, for example, the contents of an array variable? I am using cakephp and eclipse and can't seem to do this. I'm not talking about registration errors, I just print some variable value. It may be obvious and very easy to do, but I cannot find a way to do this.

thank

+3
source share
3 answers

There are no dubious questions for someone who is studying. So here are your options:

  • Place the following statement anywhere in your code debug($var);. This also works in controllers / views and models.

  • Alternative: use CakeLog :: write (LOG_DEBUG, "..."); debug values ​​log

  • , DebugKit.

+12

core.php config..

2 .

Configure::write('debug', 2);

, ,

: -

debug($data);
pr($data);
print_r($data);

cakephp. , , $this->data values ​​, url,

+6

All you have to do is use the cakephp debug function like

debug($arrayname);

Before that, you need to set the debug mode to 2 in core.php in the app / config folder

More about debug

+3
source

All Articles