Laravel:在回调请求上发送空会话

时间:2018-01-31 11:28:47

标签: laravel laravel-5.3

我只是创建一个自定义[Errno 30] Read-only file system: 'abc.pdf': OSError Traceback (most recent call last): File "/var/task/lambda_function.py", line 32, in lambda_handler return on_intent(event['request'], event['session']) File "/var/task/lambda_function.py", line 70, in on_intent return get_file(intent, session) File "/var/task/lambda_function.py", line 126, in get_file with open(filename, 'wb') as out: OSError: [Errno 30] Read-only file system: 'abc.pdf' 页面,在我的布局中显示404错误,并在404.blade.php文件中进行了一些更改。

我的代码:

app\Exceptions\Handler.php

由于会话无法启动,因此始终显示if ($exception instanceof TokenMismatchException){ return redirect($request->fullUrl())->with('csrf_error',"Oops! Seems you couldn't submit form for a long time. Please try again."); } if($exception instanceof NotFoundHttpException){ if(Auth::guard('org')->check() == false){ return response()->view('errors.web-404', [], 404); } }else{ if($exception instanceof \Illuminate\Validation\ValidationException || $exception instanceof MethodNotAllowedHttpException){ return parent::render($request, $exception); }else{ if(Auth::guard('org')->check()){ return response()->view('errors.error-page',['exception'=>$exception,'request'=>$request],500); }else{ return response()->view('errors.web-error-page',['exception'=>$exception,'request'=>$request],500); } } } return parent::render($request, $exception); Auth::guard('org')->check()。所以我在false文件中做了一些更改,一切正常。

Kernel.php

Kernel.php

但现在我注意到所有会话闪存消息和验证错误消息都无法正常工作。我认为这是因为在protected $middleware = [ \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, // Added to show 404 error inside layout \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, ]; 会话中再次初始化return back()

任何人都可以告诉我如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

尝试在kernel.php文件的中间件数组中添加这些行

AssemblyVersion.cs
祝你好运......