RouteCollection.php中的MethodNotAllowedHttpException - laravel

时间:2016-07-29 16:35:50

标签: php laravel

我收到此错误:

MethodNotAllowedHttpException in RouteCollection.php line 218

我认为一切都很好:

我的表格:

<form method="post" action="{{URL::to('/').'/cp/user/search'}}" >

我的路由器:

Route::post('cp/user/search','Panel\UserController@usersSearch');

我的控制员:

public function usersSearch(Request $request)
{
    $posts = $request->input();

    var_dump($posts['fname']);

}

1 个答案:

答案 0 :(得分:0)

您可以使用

<script type="text/javascript">
  // Get the values as numbers
  var marks = document.getElementsByClassName('sm');
  var valArr = Array.prototype.map.call(marks, function(el) {
    return parseInt(el.value)
  });
  // Sort value array in descending order
  var marks = valArr.sort(function(a, b) {
    return b - a
  });
</script>
<table id="tableID" width="200" border="1">
  <tr>
    <td width="122" class="">
      <input name="name" class="sm" id="sm" type="text" value="4" />
    </td>
    <td width="62" class="pos"></td>
  </tr>

  <tr>
    <td class="">
      <input name="name" class="sm" id="sm1" type="text" value="6" />
    </td>
    <td class="pos1"></td>
  </tr>

  <tr>
    <td class="">
      <input name="name" class="sm" id="sm2" type="text" value="10" />
    </td>
    <td class="pos2">
      <script type="text/javascript">
        var marksID = document.getElementById('sm2').value;
        var mark = parseInt(marksID);

        var valPos = marks.indexOf(mark);
        document.getElementsByClassName('pos2')[0].textContent = valPos;
      </script>
    </td>
  </tr>
  <tr>
    <td class="">
      <input name="name" class="sm" id="sm3" type="text" value="45" />
    </td>
    <td class="pos3"></td>
  </tr>
  <tr>
    <td class="">
      <input name="name" class="sm" id="sm4" type="text" value="1" />
    </td>
    <td class="pos4"></td>
  </tr>
</table>

希望这可以解决您的问题