• <small id='IiiTJ'></small><noframes id='IiiTJ'>

    • <bdo id='IiiTJ'></bdo><ul id='IiiTJ'></ul>

  • <i id='IiiTJ'><tr id='IiiTJ'><dt id='IiiTJ'><q id='IiiTJ'><span id='IiiTJ'><b id='IiiTJ'><form id='IiiTJ'><ins id='IiiTJ'></ins><ul id='IiiTJ'></ul><sub id='IiiTJ'></sub></form><legend id='IiiTJ'></legend><bdo id='IiiTJ'><pre id='IiiTJ'><center id='IiiTJ'></center></pre></bdo></b><th id='IiiTJ'></th></span></q></dt></tr></i><div id='IiiTJ'><tfoot id='IiiTJ'></tfoot><dl id='IiiTJ'><fieldset id='IiiTJ'></fieldset></dl></div>

      <tfoot id='IiiTJ'></tfoot>

    1. <legend id='IiiTJ'><style id='IiiTJ'><dir id='IiiTJ'><q id='IiiTJ'></q></dir></style></legend>
      1. Symfony - 找不到表单请求的 url

        Symfony - Form requested url not found(Symfony - 找不到表单请求的 url)

        • <small id='W6qhn'></small><noframes id='W6qhn'>

            <bdo id='W6qhn'></bdo><ul id='W6qhn'></ul>

                <tbody id='W6qhn'></tbody>
                <tfoot id='W6qhn'></tfoot>
                • <i id='W6qhn'><tr id='W6qhn'><dt id='W6qhn'><q id='W6qhn'><span id='W6qhn'><b id='W6qhn'><form id='W6qhn'><ins id='W6qhn'></ins><ul id='W6qhn'></ul><sub id='W6qhn'></sub></form><legend id='W6qhn'></legend><bdo id='W6qhn'><pre id='W6qhn'><center id='W6qhn'></center></pre></bdo></b><th id='W6qhn'></th></span></q></dt></tr></i><div id='W6qhn'><tfoot id='W6qhn'></tfoot><dl id='W6qhn'><fieldset id='W6qhn'></fieldset></dl></div>

                • <legend id='W6qhn'><style id='W6qhn'><dir id='W6qhn'><q id='W6qhn'></q></dir></style></legend>
                  本文介绍了Symfony - 找不到表单请求的 url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在做一个 symfony 项目.我正在与一个不会重定向到自己页面的表单作斗争.action 属性设置为",方法设置为 post.在这种情况下,它应该调用相同的页面,但我以 404 页面结束.

                  Im working on a symfony project. Im battleling with a form that won't redirect to its own page. The action attribute is set to "" and method set to post. In that case it should call the same page but I'm ending on a 404 page.

                  这是我在操作文件中的页面代码:

                  Here's the code of my page in the action file:

                  公共函数executeDetail(sfWebRequest $request){

                  public function executeDetail(sfWebRequest $request) {

                  if($request->isMethod(sfRequest::POST))
                  {
                  
                          if(!$this->getUser()->isAuthenticated())
                                  $this->redirect('@user_login');
                  
                          $formData = $request->getParameter($this->form->getName());
                  
                      $this->form->bind($formData, $request->getFiles($this->form->getName()));
                  
                              if ($this->form->isValid())
                      {
                          $user = $this->getUser()->getLogged();  
                  
                          $comment = $this->form->save();
                                  $comment->setIsActive(1);
                                  $comment->setAuthor($user);
                                  $comment->setHash(md5(uniqid(rand(), true)));
                                  $comment->setArticle($this->detail);
                                  $comment->save();
                  
                                  $this->status = 'SUCCESS';
                  
                  
                  
                      }
                      else
                      {
                          $this->status = 'ERROR';
                      }
                  
                  }
                           $this->story = $this->getRoute()->getObject();
                      $this->status = false;
                      $this->bAuthorLogged = false;
                  $this->form = new ArticleCommentForm();
                  } 
                  

                  有趣的是,当我从它的 url 调用页面时,它正确显示,404 仅在使用表单提交时发生.

                  The funny thing is that when I call the page from it's url it's correctly show up, 404 only happens when submitting with the form.

                  提前致谢

                  PS:路由配置为:

                  stories_detail:
                    url:   /stories-of-the-month/:slug
                    class:   sfDoctrineRoute
                    param: { module: stories, action: detail}
                    options: { model: Article, type: object, method: doSelectForSlug }
                  

                  推荐答案

                  您需要明确允许路由的 POST.将您的路线更改为:

                  You need to explicitly allow POST for the route. Change your route to:

                  stories_detail:
                    url:   /stories-of-the-month/:slug
                    class:   sfDoctrineRoute
                    param: { module: stories, action: detail}
                    options: { model: Article, type: object, method: doSelectForSlug }
                    requirements: 
                      sf_method: [get, post]
                  

                  这篇关于Symfony - 找不到表单请求的 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <i id='QfnUr'><tr id='QfnUr'><dt id='QfnUr'><q id='QfnUr'><span id='QfnUr'><b id='QfnUr'><form id='QfnUr'><ins id='QfnUr'></ins><ul id='QfnUr'></ul><sub id='QfnUr'></sub></form><legend id='QfnUr'></legend><bdo id='QfnUr'><pre id='QfnUr'><center id='QfnUr'></center></pre></bdo></b><th id='QfnUr'></th></span></q></dt></tr></i><div id='QfnUr'><tfoot id='QfnUr'></tfoot><dl id='QfnUr'><fieldset id='QfnUr'></fieldset></dl></div>

                      <tbody id='QfnUr'></tbody>

                  • <legend id='QfnUr'><style id='QfnUr'><dir id='QfnUr'><q id='QfnUr'></q></dir></style></legend>

                    <small id='QfnUr'></small><noframes id='QfnUr'>

                    1. <tfoot id='QfnUr'></tfoot>
                            <bdo id='QfnUr'></bdo><ul id='QfnUr'></ul>