RedirectResponse.php 75行中的Lumen FatalErrorException:在null上调用成员函数flashInput() [英] Lumen FatalErrorException in RedirectResponse.php line 75: Call to a member function flashInput() on null

查看:85
本文介绍了RedirectResponse.php 75行中的Lumen FatalErrorException:在null上调用成员函数flashInput()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在流明中遇到了这个错误

Hi I got this errors in Lumen

Rep.RedirectResponse.php 75行中的

FatalErrorException: 在null上调用成员函数flashInput()

FatalErrorException in RedirectResponse.php line 75: Call to a member function flashInput() on null

在RedirectResponse.php第75行

in RedirectResponse.php line 75

在RegistersExceptionHandlers.php第55行的Application-> handleShutdown()中

at Application->handleShutdown() in RegistersExceptionHandlers.php line 55

在应用程序-> Laravel \ Lumen \ Concerns {closure}()

at Application->Laravel\Lumen\Concerns{closure}()

这是引发错误的代码:

return redirect('formular')
    ->withErrors($validator)
    ->withInput();

错误来自Input()

The error comes from withInput()

推荐答案

由于Lumen 5.2不支持会话,因此发生了错误. withErrors()withInput()方法尝试在重定向器的session属性上设置值,但session属性为null.

The error is happening because Lumen 5.2 does not support sessions. The withErrors() and withInput() methods attempt to set values on the session attribute on the redirector, but the session attribute is null.

关于验证的Lumen 5.2文档:

Lumen不支持开箱即用的会话,因此,Laravel中每个视图中可用的$errors视图变量在Lumen中不可用.验证失败时,$this->validate帮助器将始终返回带有相关错误消息的JSON响应.如果您不构建仅发送JSON响应的无状态API,则应使用完整的Laravel框架.

Lumen does not support sessions out of the box, so the $errors view variable that is available in every view in Laravel is not available in Lumen. The $this->validate helper will always return JSON responses with the relevant error messages when validation fails. If you are not building a stateless API that solely sends JSON responses, you should use the full Laravel framework.

基本上,如果您尝试使用会话,则尝试以非预期的方式使用Lumen 5.2.您应该使用Lumen 5.1,或者使用完整的Laravel框架.您可以在此处阅读有关流明5.2理念更改的发行说明.

Basically, if you're trying to use sessions, you're trying to use Lumen 5.2 in a way it was not intended. You should either be using Lumen 5.1, or using the full Laravel framework. You can read the release notes here on the philosophy change for Lumen 5.2.

这篇关于RedirectResponse.php 75行中的Lumen FatalErrorException:在null上调用成员函数flashInput()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆