POST呼叫被随机称为GET(Symofny 2.8)

时间:2017-06-09 14:13:44

标签: php symfony post get

错误!未捕获的PHP异常Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException:"找不到" GET /admin/.../details/save"的路由::方法不允许(允许:POST)&# 34;在/.../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php第180行

此错误很简单,已经通过POST触发了网址。我遇到的问题是,这条路线永远不会被GET调用。

<form method="POST" action="{{ path('...', {'id': id}) }}">
        {{ form_widget(form._token) }}
        {{ form_widget(form.id) }}

        <div class="form-group">
            <label class="col-lg-2 control-label">Password</label>
            <div class="input-group col-lg-10">
                {{form_widget(form.password, {'attr':{'class': 'form-control'} })}}
                {{ form_widget(form.random) }} Random
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg-2 control-label"></label>
            {{ form_widget(form.notify) }} Notify user?
        </div>
        <div class="form-group">
            <label class="col-lg-2 control-label"></label>
            <div class="input-group col-lg-10">
                <button type="submit" class="btn btn-primary btn-lg" style="width: 33%;">Save</button>
            </div>
        </div>
    </form>

问题在整个项目中继续存在。使用GET触发Ajax调用搜索,我无法弄清楚错误的来源。没有js错误连接到此问题(使用哨兵检查)。有什么想法吗?

来自电子邮件的更多信息:

Message:    
Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: "No route found for "GET /api-v2/search": Method Not Allowed (Allow: POST)" at /.../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php line 180
Time:   
2017-06-08 17:54:31
Channel:    
request
Context:    
exception:  
{
    "class": "Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException",
    "message": "No route found for \"GET /api-v2/search\": Method Not Allowed (Allow: POST)",
    "code": 0,
    "file": "/.../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php:180",
    "trace": [
        "{\"function\":\"onKernelRequest\",\"class\":\"Symfony\\\\Component\\\\HttpKernel\\\\EventListener\\\\RouterListener\",\"type\":\"->\",\"args\":[\"[object] (Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\GetResponseEvent: {})\",\"kernel.request\",\"[object] (Symfony\\\\Component\\\\EventDispatcher\\\\ContainerAwareEventDispatcher: {})\"]}",
        "/.../vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:184",
        "/.../vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:46",

        ]
    }
}
Extra:  
request_ip: 
46.235.158.196
client_ip:  
46.235.158.196
session:    
[]
get:    
[]
post:   
[]
server: 
{
    "content-type": [
        ""
    ],
    "content-length": [
        ""
    ],
    "accept": [
        "*/*"
    ],
    "accept-language": [
        "en, *;q=0.7"
    ],
    "user-agent": [
        "Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko"
    ],
    "host": [
        "test.com"
    ],
    "connection": [
        "Keep-Alive"
    ],
    "x-php-ob-level": [
        1
    ]
}
attr:   
[]
cookies:    
[]
files:  
[]

0 个答案:

没有答案