gpt4 book ai didi

cakephp - 自定义错误页面未显示

转载 作者:行者123 更新时间:2023-12-03 07:49:48 24 4
gpt4 key购买 nike

我在CakePHP 3中有一个针对500个服务器错误的自定义错误页面。

我的src\Template\Layout\error.ctp模板文件已调整为包含默认错误模板。然后,我还通过src\Template\Error\error500.ctp更新了我的 View 文件。我什至按照docs中的描述添加了这行$this->layout = 'error';

这是我的错误 View :

<?php
use Cake\Core\Configure;
use Cake\Error\Debugger;

$this->layout = 'error';
$this->Html->addCrumb('Error');
?>

<section class="content">
<div class="error-page">
<h2 class="headline text-red">500</h2>
<div class="error-content">
<h3><i class="fa fa-warning text-red"></i> Oops! Something went wrong.</h3>
<p>
We will work on fixing that right away.
Meanwhile, you may <a href="../../index.html">return to dashboard</a> or try using the search form.
</p>
</div>
</div>
</section>

但是,它仍然显示默认的CakePHP错误页面。

enter image description here

我想念什么?

最佳答案

只需关闭app.php中的调试即可

'debug' => false

正如它在食谱中所写

Each framework layer exception has its own view file located in the core templates but you really don’t need to bother customizing them as they are used only during development. With debug turned off all framework layer exceptions are converted to InternalErrorException



有关ExceptionRenderer的详细信息,请访问 here

关于cakephp - 自定义错误页面未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37540754/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com