设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 创业者 手机 数据
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php封装的mongodb操作类代码(7)

发布时间:2021-02-23 11:22 所属栏目:121 来源:网络整理
导读:/* -------------------------------------------------------------------------------- DROP COLLECTION -------------------------------------------------------------------------------- Removes the specif

/* -------------------------------------------------------------------------------- DROP COLLECTION -------------------------------------------------------------------------------- Removes the specified collection from the database. Be careful because this can have some very large issues in production! /
public function drop_collection($collection = "") {
if (emptyempty($collection)) {
$this->error("No Mongo collection specified to drop from database",500);
} $this->db->{$collection}->drop();
return TRUE;
}

/* -------------------------------------------------------------------------------- CLEAR -------------------------------------------------------------------------------- Resets the class variables to default settings */
private function clear() {
$this->selects = array();
$this->wheres = array();
$this->limit = NULL;
$this->offset = NULL;
$this->sorts = array();
}

/* -------------------------------------------------------------------------------- WHERE INITIALIZER -------------------------------------------------------------------------------- Prepares parameters for insertion in $wheres array(). */
private function where_init($param) {
if (!isset($this->wheres[$param])) {
$this->wheres[$param] = array();
}
}

public function error($str,$t) {
echo $str;
exit;
}

}

?>

使用范例:

table_name)); $this->mongo_db->where($where); $order=!emptyempty($order)?array('AID'=>'DESC'):array('AID'=>'ASC');//升序降序 $infos=$this->mongo_db->listinfo($table_name,$order,$pagesize);

这篇文章就到这结束了,大家可以多学习一下

(编辑:ASP站长网)

网友评论
推荐文章
    热点阅读