douwen1915 2017-02-15 13:01
浏览 49

发送脚本标记时,RouteCollection.php中的MethodNotAllowedHttpException

We have a HTML form that want we to send to the server. Which sends a script tag like the following:

<div id="14871610107379120"><script type="text/JavaScript" src="https://www.aparat.com/embed/NIM3h?data[rnddiv]=14871610107379120&data[responsive]=yes"></script></div>

I then get an error about this:

MethodNotAllowedHttpException in RouteCollection.php line 218

How can I repair this error?

  • 写回答

1条回答 默认 最新

  • dongpu3792 2017-02-15 13:55
    关注

    I guess this could be a problem with using PATCH method.

    Since you are using a PATCH method. I understand that you have to add an hidden field to your form view so that Laravel can understand that its a patch request and not others:

    You can use one of these:

    {{ method_field('PATCH') }}
    

    Or this:

    <input type="hidden" name="_method" value="PATCH">
    

    But because its already a url, then you can add &_method=PATCH to the url so you'll have:

    <div id="14871610107379120"><script type="text/JavaScript" src="https://www.aparat.com/embed/NIM3h?data[rnddiv]=14871610107379120&data[responsive]=yes&_method=PATCH"></script></div>
    

    Hope this helps :)

    Note: If the answer I gave is the correct answer then this question is already answered here: MethodNotAllowedHttpException in RouteCollection.php line 219

    评论

报告相同问题?

悬赏问题

  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上