當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Db::singleton方法代碼示例

本文整理匯總了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;
 }
開發者ID:nadiajolanda,項目名稱:esAMM2014,代碼行數:11,代碼來源:Db.php

示例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;
 }
開發者ID:AdvancingJusticeLA,項目名稱:TIG-Google-Apps-Integration,代碼行數:7,代碼來源:Consumer.class.php

示例3: __construct

 function __construct()
 {
     $this->db = Db::singleton();
     $this->id = 0;
     $this->user = "";
     $this->pass = "";
     $this->email = "";
 }
開發者ID:Adriangel,項目名稱:omegame,代碼行數:8,代碼來源:User.php

示例4: __construct

 public function __construct($id = 0)
 {
     $this->pdo = Db::singleton();
     if ($id != 0) {
         $this->id = $id;
         $this->load();
     }
 }
開發者ID:AdvancingJusticeLA,項目名稱:TIG-Google-Apps-Integration,代碼行數:8,代碼來源:User.class.php

示例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';
}
開發者ID:HighTechTorres,項目名稱:TwilioCookbook,代碼行數:11,代碼來源:functions.php

示例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;
}
開發者ID:HighTechTorres,項目名稱:TwilioCookbook,代碼行數:13,代碼來源:functions.php

示例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>
開發者ID:HighTechTorres,項目名稱:TwilioCookbook,代碼行數:23,代碼來源:speaker.php

示例8: __construct

 public function __construct($uploadId)
 {
     $this->db = Db::singleton();
     $this->load($uploadId);
 }
開發者ID:badtux,項目名稱:pmg,代碼行數:5,代碼來源:image2.class.php

示例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();
 }
開發者ID:tomorrowdemo,項目名稱:haojiaolexue,代碼行數:14,代碼來源:UserGuide.php

示例10: __construct

 public function __construct($accept = array())
 {
     $this->db = Db::singleton();
     $this->acceptFileTypes = $accept;
 }
開發者ID:badtux,項目名稱:pmg,代碼行數:5,代碼來源:upload.class.php


注:本文中的Db::singleton方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。