如何在 404 后禁用 Cakephp 中的标签转义

How to disable escaping of tags in Cakephp after 404

我使用 error400.ctp 制作了一个自定义 404 页面。在这种情况下,来自 error404.ctp 的消息是正确的,但页面的页眉和页脚被转义了。

您知道如何在出现错误时禁用转义 html 吗?

CakePHP 2.0

Header 和页脚在 404 页面中的行为与在其他页面中的行为相同。只需在 404 页面中包含您的布局 $this->layout = 'your layout name',header 和页脚就会像在其他页面中一样正确显示,如果您的 header 的标题中有任何特殊字符,那么您可以使用它们escape => false 选项在你的 link.

<?php
   if (Configure::read('debug') > 0):
       echo $this->element('exception_stack_trace');
   else:
       echo $this->layout = 'your layout name';
 ?>
   // make you page stylish
 <?php endif; ?>