$data = $_POST;
$data['user_id'] = 1;
$data['create_at'] = date("Y-m-d H:i:s");
$data['update_at'] = date("Y-m-d H:i:s");
$data['is_enable'] = 1;
$data['is_visible'] = 1;
$categoryModel = new \Admin\Model\CategoryModel();
$footPosition = $categoryModel->getFootPosition();
$data['position'] = intval($footPosition) + 1;
// var_dump($data);
$categoryModel->add($data);
我開始以為是position類型不對,可是不論轉為string還是int,還是一樣報非法數據對象錯誤。$data['position'] = intval($footPosition) + 1;這個注釋掉插入數據就沒問題了。求助啊,
問題已經解決。見帖子 http://bbs.csdn.net/topics/391010865