1
當我將調試模式設置爲Production ...並且代碼中發生可恢復的錯誤時,CakePHP將在UI中輸出錯誤詳細信息。我如何防止顯示?如何防止顯示調試消息?
...調試配置設置:
Configure::write('debug', 0);
...樣本代碼,以使錯誤(一個控制器動作內):
$myError = $something['NullExceptionGoes']['HERE'];
...這將導致濾餅調試塊添加到視圖中(剛開始的body標籤下方):
將輸出錯誤詳細信息...我不希望用戶看到此信息...我想阻止顯示該塊
<pre class="cake-debug">
<a onclick="document.getElementById('cakeErr1-trace').style.display = (document.getElementById('cakeErr1-trace').style.display == 'none' ? '' : 'none');" href="javascript:void(0);"><b>Notice</b> (8)</a>
: Undefined variable: something [<b>APP/controllers/home_controller.php</b>, line <b>12</b>]
<div style="display: none;" class="cake-stack-trace" id="cakeErr1-trace">
<a onclick="document.getElementById('cakeErr1-code').style.display = (document.getElementById('cakeErr1-code').style.display == 'none' ? '' : 'none')" href="javascript:void(0);">Code</a> | <a onclick="document.getElementById('cakeErr1-context').style.display = (document.getElementById('cakeErr1-context').style.display == 'none' ? '' : 'none')" href="javascript:void(0);">Context</a><div style="display: none;" class="cake-code-dump" id="cakeErr1-code"><pre><code><span style="color: rgb(0, 0, 0);"> $this->set('title_for_layout', $title_for_layout);</span></code>
<code><span style="color: rgb(0, 0, 0);"></span></code>
<span class="code-highlight"><code><span style="color: rgb(0, 0, 0);"> $myvar = $something['nullexceptiongoeshere']['hello'];</span></code></span></pre></div>
<pre style="display: none;" class="cake-context" id="cakeErr1-context">$title_for_layout = "page title"</pre>
<pre class="stack-trace">HomeController::index() - APP/controllers/home_controller.php, line 12
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83</pre>
</div>
</pre>
你得到了什麼錯誤信息? – cspray
@pleasedontbelong ...對不起......我剛剛清理了我的舊問題......感謝提醒 – tomwag
你是否改變了''配置::寫入('debug',0);'core.php '?你有'配置::寫('調試');'在你的應用程序的任何其他地方? – JJJ