【问题标题】:Symfony : I get a 500 instead of a 404 [closed]Symfony:我得到 500 而不是 404 [关闭]
【发布时间】:2011-02-23 15:54:23
【问题描述】:

我为我的 symfony 应用程序创建了自定义 404 错误页面,但它们似乎不起作用。在开发中我看到:

This request has been forwarded to a 404 error page by the action "blabla".

但在 prod 中,页面只是空白;我收到 500 错误。

在日志中,错误是:

PHP Parse error:  syntax error, unexpected T_PUBLIC in /var/www/myproject/apps/myapp/modules/default/actions/actions.class.php on line 7

default/actions/actions.class.php 如下:

<?php
/**
 * Error page for page not found (404) error
 *
 */

public function executeError404()
{

}

public function executeSecure()
{

}
?>

我关注了this tutorial on symfony-check.org

【问题讨论】:

  • 如果我删除“公共”关键字,我会得到:PHP Fatal error: Uncaught exception 'sfError404Exception' with message 'Action "default/error404" does not exist.'

标签: symfony1 http-status-code-404


【解决方案1】:

我自己找到了答案:D 我忘记了文件的一部分:

class defaultActions extends sfActions
{
    public function executeError404() {}
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-07
    • 2015-05-26
    • 1970-01-01
    • 2017-05-03
    • 1970-01-01
    • 2021-10-05
    • 2020-07-06
    • 2018-12-27
    相关资源
    最近更新 更多