鍍金池/ 問答/PHP  數(shù)據(jù)庫/ laravel5.1 模型新增數(shù)據(jù) 執(zhí)行save()就報錯

laravel5.1 模型新增數(shù)據(jù) 執(zhí)行save()就報錯

laravel初學(xué)者小白,剛在測試學(xué)習(xí)使用curd操作,想要新增一條數(shù)據(jù),建了一個對應(yīng)的模型,無論我用哪種操作方法接收post過來的數(shù)據(jù),當(dāng)執(zhí)行到save()方法時總會報錯1054 網(wǎng)上查了很多相關(guān)資料和手冊都沒找到問題所在。請教這個情況解決方法。謝謝。。。
這是我的model和controller:

clipboard.png

第一次用了這個方法接收的數(shù)據(jù):

clipboard.png

第二次也嘗試用這種:

clipboard.png

我打了斷點(diǎn)測試過,是有接收到數(shù)據(jù)的。每次當(dāng)執(zhí)行到save(),就開始報這個錯:

clipboard.png

回答
編輯回答
懷中人

// 添加數(shù)據(jù) 返回bool值
$bool = DB::insert('insert into student(url,name) values(?,?)',['www.wxrym.com','外星人源碼商城']);
var_dump($bool);

2017年3月22日 16:55
編輯回答
安于心

UserModel里加

/**
 * 關(guān)閉自動維護(hù)updated_at、created_at字段
 * @var boolean
 */
public $timestamps = false;
2018年4月13日 11:17