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


PHP Model::dbc方法代码示例

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


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

示例1: getDbc

 public static function getDbc()
 {
     if (!self::$dbc) {
         self::$dbc = new PDO("mysql: host=" . APP_DB_HOST . "; dbname=" . APP_DB_NAME, APP_DB_USER, APP_DB_PASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"));
     }
     return self::$dbc;
 }
开发者ID:YDziashkevich,项目名称:dbParadox,代码行数:7,代码来源:model.php

示例2: dbConnect

 /**
  * Connect to the DB
  *
  * This method should be called at the beginning of any function that needs to communicate with the database
  */
 protected static function dbConnect()
 {
     if (!self::$dbc) {
         $dbc = new PDO('mysql:host=127.0.0.1;dbname=codeup_test_db', 'vagrant', 'vagrant');
         self::$dbc = $dbc;
     }
 }
开发者ID:GLenotre,项目名称:codeup.dev,代码行数:12,代码来源:Model.php

示例3: dbConnect

 private static function dbConnect()
 {
     if (!self::$dbc) {
         self::$dbc = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
         self::$dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
 }
开发者ID:zgulde,项目名称:contacts-manager,代码行数:7,代码来源:Model.php

示例4: dbConnect

 /**
  * Connect to the DB
  *
  * This method should be called at the beginning of any function that needs to communicate with the database
  */
 protected static function dbConnect()
 {
     if (!self::$dbc) {
         self::$dbc = new PDO('mysql:host=127.0.0.1;dbname=codeup_test_db', 'codeup', 'codeup');
         self::$dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
 }
开发者ID:PlatonicPoohBear,项目名称:codeup_web_exercises,代码行数:12,代码来源:Model.php

示例5: dbConnect

 protected static function dbConnect()
 {
     if (!self::$dbc) {
         self::$dbc = new PDO('mysql:host=' . $_ENV['DB_HOST'] . ';dbname=' . $_ENV['DB_NAME'], $_ENV['DB_USER'], $_ENV['DB_PASS']);
         self::$dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
 }
开发者ID:asleepArmadillo,项目名称:Adlister,代码行数:7,代码来源:BaseModel.php

示例6: dbConnect

 protected static function dbConnect()
 {
     if (!self::$dbc) {
         require __DIR__ . '/../database/db_connect.php';
         self::$dbc = $dbc;
     }
 }
开发者ID:adlister-project,项目名称:Craigslister,代码行数:7,代码来源:BaseModel.php

示例7: dbConnect

 private static function dbConnect()
 {
     if (!self::$dbc) {
         require 'db_connect.php';
         self::$dbc = $dbc;
     }
 }
开发者ID:jeromericks,项目名称:Codeup_Exercises,代码行数:7,代码来源:Model.php

示例8: dbConnect

 public static function dbConnect()
 {
     if (!self::$dbc) {
         require '../db/db_connect.php';
         self::$dbc = $dbc;
     }
 }
开发者ID:ztr-adlister,项目名称:adlister,代码行数:7,代码来源:Basemodel.php

示例9: dbConnect

 protected static function dbConnect()
 {
     if (!self::$dbc) {
         self::$dbc = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
         // Tell PDO to throw exceptions on error
         self::$dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
 }
开发者ID:Radlister,项目名称:radlister.dev,代码行数:8,代码来源:BaseModel.php

示例10: dbConnect

 protected static function dbConnect()
 {
     if (!self::$dbc) {
         // @TODO: Connect to database
         require "../database/dbconnect.php";
         self::$dbc = $dbc;
     }
 }
开发者ID:sakrog,项目名称:listmorecoals,代码行数:8,代码来源:BaseModel.php

示例11: dbConnect

 private static function dbConnect()
 {
     if (!self::$dbc) {
         require_once 'Model_login.php';
         require_once 'dbconnect.php';
         self::$dbc = $dbc;
     }
 }
开发者ID:sshaikh210,项目名称:Codeup-Web-Exercises,代码行数:8,代码来源:Model.php

示例12: dbConnect

 /**
  * Connect to the DB
  *
  * This method should be called at the beginning of any function that needs to communicate with the database
  */
 protected static function dbConnect()
 {
     if (!self::$dbc) {
         // @TODO: Connect to database
         self::$dbc = new PDO('mysql:host=' . DB_host . ';dbname=' . DB_name, DB_user, DB_password);
         self::$dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
 }
开发者ID:Penthious,项目名称:Codeup.dev,代码行数:13,代码来源:Model.php

示例13: dbConnect

 /**
  * Connect to the DB
  *
  * This method should be called at the beginning of any function that needs to communicate with the database
  */
 protected static function dbConnect()
 {
     if (!self::$dbc) {
         $dbc = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, PASSWORD);
         self::$dbc = $dbc;
         // @TODO: Connect to database
     }
 }
开发者ID:stanholzendorf,项目名称:codeup.dev,代码行数:13,代码来源:Model.php

示例14: dbConnect

 private static function dbConnect()
 {
     // If the static property $dbc has not been set, then assign it.
     if (!self::$dbc) {
         self::$dbc = new PDO('mysql:host=' . DB_HOST . ';
             dbname=' . DB_NAME, DB_USER, DB_PASS);
         // Tell PDO to throw exceptions on error
         self::$dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
 }
开发者ID:Gistslist,项目名称:DisGistsList,代码行数:10,代码来源:basemodel.php

示例15: dbConnect

 /**
  * Connect to the DB
  *
  * This method should be called at the beginning of any function that needs to communicate with the database
  */
 protected static function dbConnect()
 {
     if (!self::$dbc) {
         $servername = "localhost";
         $dbname = "parks_db";
         $username = "vagrant";
         $password = "vagrant";
         self::$dbc = new PDO("mysql:host={$servername};dbname={$dbname}", $username, $password);
         self::$dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
 }
开发者ID:Yeasayer,项目名称:codeup_web_exercises,代码行数:16,代码来源:Model.php


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