本文整理汇总了PHP中Db::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::singleton方法的具体用法?PHP Db::singleton怎么用?PHP Db::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::singleton方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Restituisce un singleton per la connessione al Db
* @return \Db
*/
public static function getInstance()
{
if (!isset(self::$singleton)) {
self::$singleton = new Db();
}
return self::$singleton;
}
示例2: create
public static function create($key, $secret)
{
$pdo = Db::singleton();
$pdo->exec("insert into oauth_consumer (consumer_key,consumer_secret,active) values ('" . $key . "','" . $secret . "',1)");
$consumer = new Consumer($pdo->lastInsertId());
return $consumer;
}
示例3: __construct
function __construct()
{
$this->db = Db::singleton();
$this->id = 0;
$this->user = "";
$this->pass = "";
$this->email = "";
}
示例4: __construct
public function __construct($id = 0)
{
$this->pdo = Db::singleton();
if ($id != 0) {
$this->id = $id;
$this->load();
}
}
示例5: order_lookup
function order_lookup($order_id)
{
global $statusArray;
$pdo = Db::singleton();
$sql = "SELECT * FROM orders where `ID` = '{$order_id}' OR `order_key` = '{$order_id}' LIMIT 1";
$res = $pdo->query($sql);
while ($row = $res->fetch()) {
return $statusArray[$row['status']];
}
return 'No Order Matching that ID was found';
}
示例6: get_user
function get_user($uid)
{
if (isset($uid) && !empty($uid)) {
$pdo = Db::singleton();
$sql = "SELECT * FROM `user` WHERE `ID`='{$uid}';";
# echo $sql;
$res = $pdo->query($sql);
while ($row = $res->fetch()) {
return $row;
}
}
return null;
}
示例7: session_start
<?php
session_start();
include "config.php";
include "pdo.class.php";
include 'Services/Twilio.php';
$pdo = Db::singleton();
$client = new Services_Twilio($accountsid, $authtoken);
$room = $_SESSION['room'];
$sql = "SELECT * FROM conference where `ID` = '{$room}'";
$res = $pdo->query($sql);
$row = $res->fetch();
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<Response>
<Dial>
<Conference startConferenceOnEnter='false'><?php
echo $row['ID'];
?>
</Conference>
</Dial>
</Response>
示例8: __construct
public function __construct($uploadId)
{
$this->db = Db::singleton();
$this->load($uploadId);
}
示例9: dbAction
/**
* db类 使用示例
*/
public function dbAction()
{
// $db_conf = RThink_Config::get('db.test');
$db_conf = array('host' => 'localhost', 'dbname' => 'test', 'username' => 'root', 'password' => '');
$db = Db::singleton($db_conf);
$db->getProfiler()->setEnabled(true);
$db_profilers[] = $db->getProfiler();
$this->getFrontController()->getRequest()->setParam('db_profilers', $db_profilers);
$stmt = $db->query('SELECT * FROM story where id > :id limit 1', array("id" => 0));
$res = $stmt->fetchAll();
}
示例10: __construct
public function __construct($accept = array())
{
$this->db = Db::singleton();
$this->acceptFileTypes = $accept;
}