我已經設置了調試模式爲2:Cakephp:pr()不顯示數據?
Configure::write('debug', 2);
我想在我的控制器使用PR(),它沒有顯示任何又名空白:
pr($this->data);
但是,如果我使用的print_r( $ this-> data),它可以顯示數據。爲什麼我的pr()不工作?
我已經設置了調試模式爲2:Cakephp:pr()不顯示數據?
Configure::write('debug', 2);
我想在我的控制器使用PR(),它沒有顯示任何又名空白:
pr($this->data);
但是,如果我使用的print_r( $ this-> data),它可以顯示數據。爲什麼我的pr()不工作?
你做PR()之前
echo Configure::read();
這應返回當前的調試級別,如果是零,其沒有被正確設置。因此,debug()或pr()不會工作,因爲它們依賴於調試大於0.
僅供參考CakePHP 2中的默認行爲將要求您指定Configure :: read('debug');獲得調試級別
只要打開你的config.php文件,然後搜索:
function Configure::write('debug',0);
與「2」或「3」替換0你會得到你想要的結果。
你可以使用debug($ this-data)嗎? – Mika 2011-03-22 08:54:26