求一個(gè)數(shù)組insert入數(shù)據(jù)庫(kù)的例子;
$field = $this->get_cache('module-'.SITE_ID.'-'.APP_DIR, 'field');
foreach ($field as $t) {
$name = $t['fieldname'];
if ($name && isset($data[$name])) $add[$t['ismain']][$name] = $data[$name];
}
參考了這個(gè) 但是一直報(bào) $this 有錯(cuò)誤(PHP小白)
https://codeigniter.org.cn/user_guide/database/query_builder.html#id8
回復(fù)@黃卿
Using $this when not in object context
直接這樣寫(xiě)的話(huà)會(huì)報(bào)錯(cuò)
看在
一樓手冊(cè)可以insert
開(kāi)源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問(wèn)題!