CakePHP :() doesn't display data?

I set the debug mode to 2:

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

I tried to use pr () in my controller, it did not display anything. aka blank:

pr($this->data);

But, if I use print_r ($ this-> data), it can display data. Why is my pr () not working?

+3
source share
3 answers

before you run the pr () command

echo Configure::read();

This should return your current debugging level, if it is zero, it is not installed correctly. Therefore, debug () or pr () do not work, as they rely on debugging greater than 0.

The default FYI behavior in CakePHP 2 will require you to specify Configure :: read ('debug'); to get the debug level

+3
source

pr() , . , . app.php CakePHP ​​:

'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN)

0

Just open the config.php file and search:

 function Configure::write('debug',0);

Replace 0 with "2" or "3", you will get the desired result.

-2
source

All Articles