PHP分析错误:语法错误,意外的T_OBJECT_运算符,第1行应为']'
我使用下面的语句在命令提示符下使用php artisan tinker在表“songs”中输入数据,但它显示了php解析错误:语法错误,意外的T_OBJECT_运算符,第1行应为']' 使用=>而不是-> 插入物中的东西是一个。PHP分析错误:语法错误,意外的T_OBJECT_运算符,第1行应为']',php,laravel-5.4,Php,Laravel 5.4,我使用下面的语句在命令提示符下使用php artisan tinker在表“songs”中输入数据,但它显示了php解析错误:语法错误,意外的T_OBJECT_运算符,第1行应为']' 使用=>而不是-> 插入物中的东西是一个。 DB::table('songs')->insert(['title'->'Closer','artist'->'chainsmokers','created_at'->new DateTime,'updated_at'->new Date
DB::table('songs')->insert(['title'->'Closer','artist'->'chainsmokers','created_at'->new DateTime,'updated_at'->new DateTime ]);
DB::table('songs')->insert([
'title' => 'Closer',
'artist' => 'chainsmokers',
'created_at' => new DateTime,
'updated_at' => new DateTime,
]);