第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

一次調(diào)用為啥總插入兩條相同數(shù)據(jù)???

????public?function?add()?{
//????????$result?=?DB::insert('insert?into?student(name,?age)?values(?,??)',?['xxx',?18]);
//????????var_dump($result);

????????$result?=?DB::table('student')
????????????->insertGetId(['name'?=>?'mmm',?'age'=>20]);
????????var_dump($result);

????????return?"StudentController?-?add";
????}

我使用 兩種方式插入數(shù)據(jù), 每次訪問(wèn)一次接口,數(shù)據(jù)庫(kù)總是插入兩條相同的數(shù)據(jù),除了 主鍵外,其他都相同,是為什么呢?

mysql> select * from student;

+-----+------+-----+-----+------------+------------+

| id? | name | age | sex | created_at | updated_at |

+-----+------+-----+-----+------------+------------+

| 108 | mmm? |? 20 | ? 0 |? ? ? ? ? 0 |? ? ? ? ? 0 |

| 109 | mmm? |? 20 | ? 0 |? ? ? ? ? 0 |? ? ? ? ? 0 |

+-----+------+-----+-----+------------+------------+


正在回答

1 回答

你這里添加一次了??$result?=?DB::table('student')?->insertGetId(['name'?=>?'mmm',?'age'=>20]);

?return?"StudentController?-?add";這里又一次;所以是兩次
0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

一次調(diào)用為啥總插入兩條相同數(shù)據(jù)???

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)