【问题标题】:How do i use head method in routes in laravel ? something like this Route::head('abc/{id}', 'def@ghi'); [duplicate]如何在 laravel 的路线中使用 head 方法?像这样 Route::head('abc/{id}', 'def@ghi'); [复制]
【发布时间】:2020-02-06 10:34:03
【问题描述】:

我想检查资源是否存在,因为我应该使用 head 方法。我给了这样的路线

Route::head('abc/{id}', 'def@ghi');

但它给了我 500 个内部服务器错误,没有任何错误。

【问题讨论】:

    标签: javascript php jquery ajax laravel


    【解决方案1】:

    head 不是路由器上可用的方法,Illuminate\Routing\Router

    您创建的所有get 路由也为head 设置。

    /**
     * Register a new GET route with the router.
     *
     * @param  string  $uri
     * @param  \Closure|array|string|callable|null  $action
     * @return \Illuminate\Routing\Route
     */
    public function get($uri, $action = null)
    {
        return $this->addRoute(['GET', 'HEAD'], $uri, $action);
    }
    

    【讨论】:

      猜你喜欢
      • 2014-08-11
      • 2017-09-09
      • 2014-04-02
      • 1970-01-01
      • 2020-04-15
      • 1970-01-01
      • 2021-12-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多