我在使用cakephp中的create()方法時遇到問題。我有下面的代碼,當我在調試中運行它時,它只是在創建行之後嘗試遍歷它時恢復程序。
$this->CompanyDeviceQuestionConcern->create();
$this->CompanyDeviceQuestionConcern->set('source_company_id', $company_id);
$this->CompanyDeviceQuestionConcern->set('user_id', $user['id']);
$this->CompanyDeviceQuestionConcern->set('create_date', date('Y-m-d H:i:s'));
$this->CompanyDeviceQuestionConcern->set('modified_date', date('Y-m-d H:i:s'));
有沒有人知道爲什麼當我運行第一行時崩潰?
定義「崩潰」的任何詳細信息。你會得到什麼錯誤?怎麼了? – PeeHaa
「當我在調試中運行它時,它只是在創建行之後嘗試遍歷它時恢復程序。」沒有錯誤,這使得它很難調試。 –
爲什麼它不會在'create()'後恢復? create()只是重置模型。在所有set()調用完成後調用' - > save()'並保存到數據庫中。 – Costa