首页 > 技术文章 > thinkphp知识点

cnn2017 2017-09-04 10:44 原文

model层编写curd(模型命名格式 类名(userModel)+class.php )

//添加方法
public function insertOne($data)
{
	return $this->Table('blog_tag')->add($data);
}

//查询多条方法
public function selectOne()
{
	return $this->Table('blog_tag')->select();
}

//删除
public function deleteOne($id)
{
  	return $this->Table('blog_tag')->where("tag_id=$id")->delete();
}


 //查询单条
  public function updateOne($id)
  {
  	return $this->Table('blog_tag')->where("tag_id=$id")->find();
  }


//修改方法
  public function updateTwo($data)
  {
  	return $this->Table('blog_tag')->save($data);
  }

  

推荐阅读