Symfony1 Symfony:添加新操作/视图错误。(新问题)

Symfony1 Symfony:添加新操作/视图错误。(新问题),symfony1,module,http-status-code-404,action,Symfony1,Module,Http Status Code 404,Action,我在尝试添加新模块页面时得到了404。我显然错过了一些基本的东西,作为Symfony的新手。有人能指出我遗漏了什么吗 非常感谢 modules/admin/actions/actions.class.php /* following executeIndex() */ public function executeSchedule() { if ($this->getRequest()->getethod() != sfRequest::POST) {

我在尝试添加新模块页面时得到了404。我显然错过了一些基本的东西,作为Symfony的新手。有人能指出我遗漏了什么吗

非常感谢


modules/admin/actions/actions.class.php

/* following executeIndex() */

public function executeSchedule()
{
    if ($this->getRequest()->getethod() != sfRequest::POST)
    {
        return sfView::SUCCESS;
    }
    else
    {
        $name = $this->getRequestParameter('first_name');
        echo $name;
    }
}
modules/admin/templates/schedulesucture.php

<?=set_title('Schedule')?>

<form action="/admin/schedule" method="POST">
<input name="foo" type="text">
<?php echo submit_tag('Schedule'); ?></p
  • 永远不要硬编码url,使用url\u之类的帮助程序
  • 使用表单框架
  • 阅读教程:

  • 另外,不要在你的行动中附和。使用setContent助手

    在你的情况下:

    $name = $this->getRequestParameter('first_name');
    $this->getResponse()->setContent($name);
    

    您是否在routes.yml中设置了将url路由到此控制器的路由?是的,我为该链接设置了路由。我试过两种方法。不过,表单操作不需要路由,对吗?我正在使用表单帮助程序,不知道它们是否导致了此问题。耸肩表单标签('admin/schedule')、输入标签('foo')等等。echo只是为了测试某种输出。打印也不起作用。作为旁注,更改表单的方法以获得作品,这很奇怪。这是我目前的解决办法。。。
    $name = $this->getRequestParameter('first_name');
    $this->getResponse()->setContent($name);