简体   繁体   English

zend framework:404仅显示是否禁用了布局

[英]zend framework: 404 only shows if layout is disabled

Locally, my error controller works just fine and sends the error message for both 404 and 500 error messages. 在本地,我的错误控制器工作正常,并发送404和500错误消息的错误消息。 However, when the system is live, only 500 messages are displayed, not 404's (the browser still receives the 404 header from the code, but nothing is displayed; just the browser default). 但是,当系统处于活动状态时,仅显示500条消息,而不显示404(浏览器仍从代码中接收404标头,但不显示任何内容;仅显示浏览器的默认信息)。 If I disable the layout in the error controller, both errors are thrown. 如果我在错误控制器中禁用了布局,则会抛出两个错误。

So it seems with a layout, my 404 doesn't work. 如此看来,我的404无法正常工作。 Any ideas why? 有什么想法吗? My error controller is essentially the same as the one in the docs: http://framework.zend.com/manual/en/zend.controller.plugins.html but with some modifications (send email on 500, set view renderers for error type). 我的错误控制器与文档中的错误控制器基本相同: http : //framework.zend.com/manual/en/zend.controller.plugins.html,但进行了一些修改(在500上发送电子邮件,为错误设置视图渲染器类型)。

If I put <? exit; ?> 如果我放<? exit; ?> <? exit; ?> <? exit; ?> at the end of my notfound view script, the content is shown up until then so the view is working correctly. <? exit; ?>在我结束notfound视图脚本,内容显示直到那时这样的观点是否正常工作。

It is possible that it is the result on an error in your 404 error controller action view script, which is suppressed, so you only get a blank page. 可能是由于您的404错误控制器操作视图脚本中的错误导致的结果被抑制,因此您只能得到空白页。 You can try to put up a staging server, which contain the same setup and config as production except for displaying of errors to more closely see what's going on. 您可以尝试建立一个登台服务器,该服务器包含与生产相同的设置和配置,除了显示错误以更仔细地了解发生了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM