【发布时间】:2018-07-30 19:44:24
【问题描述】:
这里有专家吗?这是我面临的一个非常奇怪的问题。
我的网站托管在 aws 机器上。代码在那里工作得非常好。然后它被转移到另一台服务器上,这个奇怪的问题就出现了。
我有更新汽车的路线
Route::put('vehicles/{vehicle}', 'VehicleController@update');
编辑表格
{!! Form::model($vehicle, ['url' => ['backend/vehicles', $vehicle->id], 'method' => 'put','files' => true , 'class' => 'form-horizontal form-label-left', 'role' => 'form']) !!}
@include( 'backend.vehicles.form' )
{!! Form::close() !!}
现在这是奇怪行为开始的地方,每当我尝试更新在服务器移动之前创建的汽车时,它会在 RouteCollection.php 中显示 MethodNotAllowedHttpException
但是当我创建一辆车然后更新这辆新车时,操作成功了。请帮忙。
还有一件事,在 routeCollection.php 中,它匹配请求的路由,它显示旧车的 GET 方法,但新车的 put 方法
public function match(Request $request){
// die($request->getMethod()); $routes = $this->get($request->getMethod());
$route = $this->check($routes, $request);
if (! is_null($route)) {
return $route->bind($request);
}
// If no route was found we will now check if a matching route is specified by
// another HTTP verb. If it is we will need to throw a MethodNotAllowed and
// inform the user agent of which HTTP verb it should use for this route.
$others = $this->checkForAlternateVerbs($request);
if (count($others) > 0) {
return $this->getRouteForMethods($request, $others);
}
throw new NotFoundHttpException;
}
请任何人。
【问题讨论】:
标签: php laravel-5.2