本文整理汇总了PHP中DBConnection::instantiate方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnection::instantiate方法的具体用法?PHP DBConnection::instantiate怎么用?PHP DBConnection::instantiate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnection
的用法示例。
在下文中一共展示了DBConnection::instantiate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->_mongo = DBConnection::instantiate();
$this->_collection = $this->_mongo->getCollection(User::COLLECTON);
if ($this->isLoggedIn()) {
$this->_loadData();
}
}
示例2: __construct
public function __construct($id = null)
{
$this->_mysql = getMySQLConnection();
$this->_mongodb = DBConnection::instantiate();
$this->_collection = $this->_mongodb->getCollection('customer_metadata');
$this->_table = 'customers';
if (isset($id)) {
$this->_id = $id;
$this->_load();
}
}
示例3: __construct
public function __construct()
{
$this->_mongo = DBConnection::instantiate();
$this->_collection = $this->_mongo->getCollection(SessionManager::COLLECTION);
session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc'));
// configura periodo recolección de basura
ini_set('session.gc_maxlifetime', SessionManager::SESSION_LIFESPAN);
session_set_cookie_params(SessionManager::SESSION_LIFESPAN, SessionManager::SESSION_COOKIE_PATH, SessionManager::SESSION_COOKIE_DOMAIN);
session_name(SessionManager::SESSION_NAME);
session_cache_limiter('nocache');
session_start();
}
示例4: array
<?php
require 'dbconnection.php';
$mongo = DBConnection::instantiate();
$collection = $mongo->getCollection('sample_articles');
$key = array('author' => 1);
$initial = array('count' => 0, 'total_rating' => 0);
$reduce = "function(obj, counter) { counter.count++; counter.total_rating += obj.rating;}";
$finalize = "function(counter) { counter.avg_rating = Math.round(counter.total_rating / counter.count); }";
$condition = array('published_at' => array('$gte' => new MongoDate(strtotime('-1 day'))));
$result = $collection->group($key, $initial, new MongoCode($reduce), array('finalize' => new MongoCode($finalize), 'condition' => $condition));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Author Rating</title>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<div id="contentarea">
<div id="innercontentarea">
<h1>Authors' Ratings</h1>
<table class="table-list" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th width="50%">Author</th>
<th width="24%">Articles</th>
<th width="*">Average Rating</th>
</tr>
示例5: getArticleTitle
<?php
require 'dbconnection.php';
$dbConnection = DBConnection::instantiate();
$collection = $dbConnection->getCollection('article_visit_counter_daily');
function getArticleTitle($id)
{
global $dbConnection;
$article = $dbConnection->getCollection('articles')->findOne(array('_id' => new MongoId($id)));
return $article['title'];
}
$objects = $collection->find(array('request_date' => new MongoDate(strtotime('today'))));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Daily Page views (in realtime)</title>
<link rel="stylesheet" href="style.css"/>
<style type="text/css" media="screen">
body { font-size: 13px; }
div#contentarea { width : 680px; }
</style>
</head>
<body>
<div id="contentarea">
<div id="innercontentarea">
<h1>Daily Page views (in realtime)</h1>
<table class="articles" cellspacing="0" cellpadding="0">
<thead>
<tr>
示例6: __construct
public function __construct()
{
$this->_dbconnection = DBConnection::instantiate();
$this->_collection = $this->_dbconnection->getCollection(LOGNAME);
}