代码拉取完成,页面将自动刷新
同步操作将从 coolcooldee/php_framework 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
class Nodel{
protected $table_name;
//public function cache($cached_time = 3600) {
//
// return new DBCache;
//}
protected function table($table_name=null, $db_name=null) {
$db_name = ($db_name == null) ? $GLOBALS['mongo']['MONGO_DB'] : $db_name;
$table_name = ($table_name == null) ? $this->table_name : $table_name;
if(!isset($GLOBALS['db_tmp_mongo_collection'][$db_name][$table_name])){
if(!isset($GLOBALS['db_tmp_mongo_collection'])) $GLOBALS['db_tmp_mongo_collection'] = array();
if(!isset($GLOBALS['db_tmp_mongo_collection'][$db_name])) $GLOBALS['db_tmp_mongo_collection'][$db_name] = array();
$GLOBALS['db_tmp_mongo_collection'][$db_name][$table_name] = new MongoCollection($this->db($db_name), $table_name);
}
return $GLOBALS['db_tmp_mongo_collection'][$db_name][$table_name];
}
protected function db($db_name=null) {
if(!isset($GLOBALS['db_tmp_mongo']))$this->_init();
$db_name = ($db_name == null) ? $GLOBALS['mongo']['MONGO_DB'] : $db_name;
if(!isset($GLOBALS['db_tmp_mongodb'][$db_name])){
if(!isset($GLOBALS['db_tmp_mongodb'])) $GLOBALS['db_tmp_mongodb'] = array();
if( isset( $GLOBALS['mongo']['MONGO_USERNANE'] ) && isset( $GLOBALS['mongo']['MONGO_PASSWD'] ) ){
$GLOBALS['db_tmp_mongo']->selectDB($db_name)->authenticate( $GLOBALS['mongo']['MONGO_USERNANE'], $GLOBALS['mongo']['MONGO_PASSWD'] );
$GLOBALS['db_tmp_mongodb'][$db_name] = $GLOBALS['db_tmp_mongo']->selectDB($db_name);
}else{
$GLOBALS['db_tmp_mongodb'][$db_name] = $GLOBALS['db_tmp_mongo']->selectDB($db_name);
}
}
return $GLOBALS['db_tmp_mongodb'][$db_name];
}
private function _init() {
$param = array();
if( isset( $GLOBALS['mongo']['MONGO_USERNANE'] ) && isset( $GLOBALS['mongo']['MONGO_PASSWD'] ) ){
$param = array( 'username'=> $GLOBALS['mongo']['MONGO_USERNANE'] , 'password'=>$GLOBALS['mongo']['MONGO_PASSWD'] );
}
try{
$GLOBALS['db_tmp_mongo'] = new Mongo('mongodb://'.$GLOBALS['mongo']['MONGO_HOST'].':'.$GLOBALS['mongo']['MONGO_PORT'], $param );
}catch(Exception $e){
throw new Exception('mongodb cannot connect on'.$GLOBALS['mongo']['MONGO_HOST'].':'.$GLOBALS['mongo']['MONGO_PORT']);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。