Unexpected data found. Unexpected data found. Data missing

2018-01-17 23:36:26

错误代码

public function write($category,Request $request)
{
   $title = UsedCarCategory::find($category)->name;
   $id = $request->input('id');

   $article = "";
   if($id==""){
       /*添加文章*/
   }else{

       $article = UsedCar::find($id);
   }

   return view('/usedCar/write',["article"=>$article,"title"=>$title,"category"=>$category]);
}

上面的代码,再正常不过了,不知道为啥出现了下面的错误

InvalidArgumentException
Unexpected data found. Unexpected data found. Data missing


从网上查出


up vote1down voteaccepted

You're passing null as a string instead of the datatype. Remove the quotes, and it will work:

$date = Carbon::createFromDate(null, rand(1,12), rand(1,28));
// object(Carbon\Carbon)(
//   'date' => '2017-06-02 10:28:17.000000',
//   'timezone_type' => 3,
//   'timezone' => 'America/New_York'
// )

Your next error, you're missing a second colon after DB:

DB::table('utilisateurs')->insert


我仔细检查我没有这个错误。


后来去数据库看,并不是我的错误,代码并没有错误。


created_at   我竟然设置成了time字段。

然后就报错了,不能查询出时间的原因,应该是timestamp才对。


哎 ,这错误。

  • 2021-01-08 16:47:37

    nodejs如何使用fetch

    node 中没有实现 fetch,你可以使用 node-fetch,使得在 node 中也可以使用 fetch.

  • 2021-01-08 16:49:59

    CommonJs 与 ESModule区别

    node中模块导入require是一个内置的函数,因此只有在运行后我们才可以得知模块导出内容,无法做静态分析

  • 2021-01-08 16:54:08

    如何在 Node.js 中使用 import / export 的三种方法

    注:第1、2种方法均是借助 babel,需要注意的是文章使用的babel版本 < 7。从 babel 7.X 版本开始,部分包名、用法发生了些许变化,大体与7之前的用法类似,详细请到官方手册学习 7.X 版本的改动(Babel 踩坑总结(三) —— 7.X 版本升级是我对 7.X 版本三大改动的总结)

  • 2021-01-10 17:19:00

    libc++_shared是什么冲突

    NDK 支持多种 C++ 运行时库。本文档介绍了这些库的相关信息、所涉及的折衷做法以及库的使用方法。