当前位置: 首页>>代码示例>>PHP>>正文


PHP Database::get方法代码示例

本文整理汇总了PHP中core\Database::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::get方法的具体用法?PHP Database::get怎么用?PHP Database::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core\Database的用法示例。


在下文中一共展示了Database::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Create a new instance of the database helper.
  */
 public function __construct()
 {
     /**
      * connect to PDO here.
      */
     $this->db = \Core\Database::get();
 }
开发者ID:krishnasrikanth,项目名称:smvc-php7,代码行数:10,代码来源:Model.php

示例2: __construct

 public function __construct()
 {
     $this->db = Database::get();
 }
开发者ID:ayrtonmonier,项目名称:babita,代码行数:4,代码来源:Testes.php

示例3: getWhere

 public static function getWhere($sql = '', $values = [])
 {
     $database = \Core\Database::get(static::getModelDatabase());
     $data = $database->query('SELECT * FROM `' . static::getModelTable() . '` ' . $sql, $values);
     $data = static::preProcessGetWhere($data);
     if (!is_array($data)) {
         throw new ModelException('Array not returned in Model::getWhere');
     }
     $result = [];
     foreach ($data as $row) {
         $class = get_called_class();
         $model = new $class();
         $model->populate($row);
         $result[] = $model;
     }
     return $result;
 }
开发者ID:AndrewMontagne,项目名称:MontagneMVC,代码行数:17,代码来源:base.php

示例4: __construct

 /**
  * Table builder constructor.
  * Database class initialization, don't create too many instances of table builder,
  * because it will create many database instances which will decrease performance.
  * By default this class would create a `id` field INT(11) NOT null AUTO_INCREMENT PRIMARY KEY, unless
  * you'll set second parameter false.
  *
  * @param PDO|null $db
  *        	- PDO instance (it can be a \helper\database instance)
  * @param boolean $id
  *        	- A flag to add or not to add `id` field automatically
  */
 public function __construct(PDO $db = null, $id = true)
 {
     // If database is not given, create new database instance.
     // database is in the same namespace, we don't need to specify namespace
     $this->db = !$db ? Database::get() : $db;
     if ($id === true) {
         $this->addField('id', 'INT(11)', false, self::AUTO_INCREMENT);
         $this->setPK('id');
     }
 }
开发者ID:krishnasrikanth,项目名称:smvc-php7,代码行数:22,代码来源:TableBuilder.php

示例5: __construct

 /**
  * create a new instance of the database helper
  */
 public function __construct()
 {
     //connect to PDO here.
     $this->db = Database::get();
 }
开发者ID:ayrtonmonier,项目名称:babita,代码行数:8,代码来源:Model.php


注:本文中的core\Database::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。