Trying to get property 'headers' of non-object 错误。

登录系统后,清空了数据库,出现如下错误。
登录系统后,清空了数据库,出现

/**
     * Add the CSRF token to the response cookies.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Symfony\Component\HttpFoundation\Response  $response
     * @return \Symfony\Component\HttpFoundation\Response
     */
    protected function addCookieToResponse($request, $response)
    {
        $config = config('session');
        if ($response instanceof Responsable) {
            $response = $response->toResponse($request);
        }
        $response->headers->setCookie(
            new Cookie(
                'XSRF-TOKEN', $request->session()->token(), $this->availableAt(60 * $config['lifetime']),
                $config['path'], $config['domain'], $config['secure'], false, false, $config['same_site'] ?? null
            )
        );
        return $response;
    }
    /**
     * Determine if the cookie contents should be serialized.
     *
     * @return bool
     */
    public static function serialized()

提示的是下面这行

 $response->headers->setCookie(
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 2

这个在说你传进去的$response非法法,拿不到headers属性。 你自己看下addCookieToResponse的入参就好了

5年前 评论

你解决没有,我也出现这个问题,不知道怎么处理

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!