1.入口
laravel的请求处理入口在Illuminate\Foundation\Http\Kernel::handle方法里:
public function handle($request)
{
try {
$request->enableHttpMethodParameterOverride();
$response = $this->sendRequestThroughRouter($request);
} catch (Throwable $e) {
$this->reportException($e);
$response = $this->renderException($request, $e);
}
$this->app['events']->dispatch(
new RequestHandled($request, $response)
);
return $response;
}
2.启用请求方法覆盖
其实很简单,有些客户端无法发送PUT/PATCH等REST请求,所以使用参数来覆盖请求方法
在Symfony\Component\HttpFoundation\Request里
public function getMethod()
{
if (null !== $this->method) {
return $this->method;
}
$this->m