亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Laravel 不允許序列化“Closure”

Laravel 不允許序列化“Closure”

PHP
大話西游666 2023-09-22 16:19:33
錯誤:存儲數據時“不允許序列化閉包”。我在文本區域上使用 CKEditor。當沒有更多文本時,數據會被存儲,但當有更多文本(如第一個問題)并且在https://www.lipsum.com上得到回答時 ,則會在保存數據時顯示錯誤。存儲功能public function store(Request $request){    $this->validate($request, [        'noticeTitle'        => 'required',        'noticeDesc'       => 'required',    ]);    $notice = new Notice;    $notice->noticeTitle = $request->input('noticeTitle');    $notice->noticeDesc = $request->input('noticeDesc');    $notice->batch_id = $request->input('targetedGroup');    if($request->hasFile('add_file')) {        $noticeTitle = $request->input('noticeTitle');        $filename  = $request->add_file->getClientOriginalName();        $request->add_file->storeAs('public/noticeFile/additionalFiles', $noticeTitle.'_'.$filename);        $path = $noticeTitle.'_'.$filename;        $notice->file = $path;    }    dd($notice);    try{        $notice->save();        Session::flash('success', 'Notice Saved');        return redirect()->route('notice.index');    }    catch (\Throwable $th){        Session::flash('danger', $th);        return redirect()->route('notice.index');    }}$notice 變量的轉儲如下"noticeTitle" => "Lorem Ipsum Notice New"    "noticeDesc" => """      <h2>What is Lorem Ipsum?</h2>            <p><strong>Lorem Ipsum</strong>&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&#39;s standard dummy text  ?      """    "batch_id" => "3"    "file" => "Lorem Ipsum Notice New_s.pdf"  ]
查看完整描述

1 回答

?
HUWWW

TA貢獻1874條經驗 獲得超12個贊

解決了。問題不在于商店功能,而在于遷移。對于 CKEditor 上的數據,我使用的是stringon migration。改了text之后問題就解決了。

查看完整回答
反對 回復 2023-09-22
  • 1 回答
  • 0 關注
  • 105 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號