当前位置: 首页>>代码示例>>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;未经允许,请勿转载。