IWeb修改IModel类的setData方法方便调用修改添加
/lib/web/model/model_class.php
/**
* @brief 设置要更新的表数据
* @param array $data key:字段名; value:字段值;
*/
public function setData($data)
{
if(is_array($data))
{
$this->tableData = $data;
}
return $this;
}
调用的时候直接
$model = new IModel('user');
$model->setData(array('username'=>'aaa','password'=>'aaaaa'))->add();
$model->setData(array('username'=>'aaa','password'=>'aaaaa'))->update('id=1');
结合帮助函数使用
model('user')->setData(array('username'=>'aaa','password'=>'aaaaa'))->add();
model('user')->setData(array('username'=>'aaa','password'=>'aaaaa'))->update('id=1');