Re: [請益] php 8 新增資料遇到困難(laravel+my

看板PHP作者 (INCREMENT)時間10月前 (2023/06/02 14:46), 10月前編輯推噓2(200)
留言2則, 2人參與, 10月前最新討論串1/1
※ 引述《stayfool》之銘言 : 程式如下 : $flight = new Product; : $flight->name = "iphone";//此行出錯 : $flight->save(); : 錯誤訊息 count(): Argument #1 ($value) must be of type Countable|array : $flight->name = "iphone" : 改成 $flight->name = ["iphone"] : 改成 $flight->name = (array)["iphone"] : 都會得到相同的錯誤訊息,請問正確的語法? 沒有看 model 程式碼 的情況下先猜測 是不是 fillable 沒有把 name 設置上去 ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.194.161.118 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1685688400.A.0E2.html ※ 編輯: thinklikes (123.194.161.118 臺灣), 06/02/2023 14:54:51

06/03 16:08, 10月前 , 1F
我也猜這個
06/03 16:08, 1F

06/04 04:22, 10月前 , 2F
他的寫法不是批量賦值,跟fillable應該沒關係?
06/04 04:22, 2F
文章代碼(AID): #1aUP1G3Y (PHP)
文章代碼(AID): #1aUP1G3Y (PHP)