I have set the debug mode to 2:
Configure::write('debug', 2);
开发者_运维技巧
I tried to use pr() in my controller, it didnt display anything a.k.a blank:
pr($this->data);
But, if I use print_r($this->data), it can display the data. Why my pr() is not working?
just before you do the pr()
echo Configure::read();
This should return your current debug level, if it is zero, its not being set correctly. Hence debug() or pr() wont work as they rely on debug being greater than 0.
FYI the default behaviour in CakePHP 2 will require you to specify Configure::read('debug'); to get the debug level
pr()
works only if debugger mode is on. So check it once and ensure that its on or off.
In app.php of CakePHP you should have this configuration:
'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN)
Just open your config.php file and search for:
function Configure::write('debug',0);
Replace 0 with '2' or '3' you will get your desired result.
精彩评论