2007年12月25日 星期二

How to enable/disable debug messages for a certain action

An often asked question in the CakePHP IRC channel is: “How can I enable [or disable] the debug messages for a certain action?” The answer to this question is simple (works in both CakePHP 1.1 and 1.2):

function action() {
Configure::write('debug', '2');

// do something
}


Please notice that the key must be in lowercase, ‘DEBUG’ won’t have the desired effect.

沒有留言:

wibiya widget