Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php ';未根据请求设置会话存储';包括标题后_Php_Laravel_Laravel 5 - Fatal编程技术网

Php ';未根据请求设置会话存储';包括标题后

Php ';未根据请求设置会话存储';包括标题后,php,laravel,laravel-5,Php,Laravel,Laravel 5,我在handler.php文件中使用以下异常处理程序: public function render($request, Exception $e) { if ($e instanceof CustomException) { return response()->view('errors.404', [], 404); } return parent::render($request, $e); } 在我将标题包含到404.blade.php文

我在handler.php文件中使用以下异常处理程序:

public function render($request, Exception $e)
{
    if ($e instanceof CustomException) {
        return response()->view('errors.404', [], 404);
    }

    return parent::render($request, $e);
}
在我将标题包含到
404.blade.php
文件之前,它工作正常:

@include('includes.header')
我开始收到此错误:

Session store not set on request. (View: C:\xampp\htdocs\sharp\resources\views\includes\header.blade.php)

由于未找到路由,因此启动会话的
web
中间件从未应用

我不喜欢,但它是相关的

取而代之的是,考虑将参数传递给嵌套的模板,指定是否调用模板调用“代码> Auth::USER())/>代码>,通过<代码> @如果刀片指令。< /P> 比如:

@include('includes.header',['omit_auth'=>true])
然后在标题模板中:

@if(!empty($omit_auth))
{{Auth::user()->name}
@恩迪夫

您的
includes.header
模板的内容是什么?您正在访问该模板中的会话吗?是的,我正在使用Auth::user()作为示例。