0
我看到一個可以使用與JTable的負載的陣列,我試過如下:的Joomla JTable中裝載數組和編輯字段
public function delete($id = null) {
$app = JFactory::getApplication();
$id = $id ? $id : $app->input->get('files', array(), 'ARRAY');
$file = JTable::getInstance('Document','Table');
$file->load($id);
$file->date_removed = date("Y-m-d H:i:s",time());
if($file->store())
{
return true;
} else {
return false;
}
}
print_r($id)
是:
Array
(
[0] => 1
[1] => 2
)
,但我有沒有運氣。我不斷收到以下錯誤:
0 - 缺少字段在數據庫:TableDocument 1.
任何幫助非常感謝。
啊謝謝,我明白了,你的建議似乎工作好了很多,唯一的事情是,它不更新:date_removed –
似乎很好地工作,如果我換$ return || $ file-> store()左右。 –
是的,在我的回答中可能有錯(沒有在現場測試過),更新了我的答案; – di3sel