不允许序列化“闭包" - laravel
问题描述
我正在尝试在我的表中创建一个元组.数据来自表格或收到.我的数据库:
I'm trying to create a tuple in my table. The data is from a form or received. My database:
查看
路线
型号
控制器
当完全改变表单并发送时,出现以下错误
When completely changes the form and send it, the following error
我该如何解决?
推荐答案
你的控制器有错字:->withErros($validator)
- 它应该是 withErrors.差别很大.
You have a typo in your controller: ->withErros($validator)
- it should be withErrors
. The difference is big.
Laravel 将 withErros($validator)
转换为 with(['erros' => $validator])
,意思是尝试将整个验证器对象放入会议.要将东西放入会话存储中,首先需要对其进行序列化,这就是导致错误的原因.
Laravel converts withErros($validator)
into with(['erros' => $validator])
, which means trying to put the entire validator object into the session. To put things into the session storage, it needs to be serialized first, which is what is causing the error.
这篇关于不允许序列化“闭包" - laravel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!