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


PHP DB::__construct方法代码示例

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


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

示例1: __construct

 public function __construct($vars = null)
 {
     parent::__construct();
     $this->scrubber = new Scrubber();
     $this->template = new Template();
     $this->cleaned = $this->scrubber->fromHtml($vars);
 }
开发者ID:btoll,项目名称:benjamintoll.com,代码行数:7,代码来源:ItalyDAO.php

示例2: __construct

 public function __construct($vars = null)
 {
     parent::__construct();
     #$this->template = new Template;
     $this->post = $vars;
     $this->scrubber = new Scrubber();
 }
开发者ID:btoll,项目名称:benjamintoll.com,代码行数:7,代码来源:LinuxDAO.php

示例3: __construct

 public function __construct($table = null)
 {
     parent::__construct();
     if ($table != null) {
         $this->table($table);
     }
     return $this;
 }
开发者ID:spiritwolf,项目名称:Cellular,代码行数:8,代码来源:model.php

示例4: __construct

 public function __construct(array $options = [])
 {
     $defaults = [];
     $options += $defaults;
     parent::__construct($options);
     $this->tableMain = 'predb';
     $this->tableTemp = 'predb_imports';
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:8,代码来源:PreDb.php

示例5:

 function __construct()
 {
     parent::__construct();
     $this->receiveMessage();
     $this->loadData();
     $this->showALLMessages();
     $this->showForm();
 }
开发者ID:ABOTGAO,项目名称:message,代码行数:8,代码来源:message.board.php

示例6: __construct

 public function __construct($vars = null)
 {
     parent::__construct();
     $this->scrubber = new Scrubber();
     if (!is_null($vars)) {
         $this->cleaned = $this->scrubber->fromHtml($vars);
     }
 }
开发者ID:btoll,项目名称:benjamintoll.com,代码行数:8,代码来源:ContactDAO.php

示例7: __construct

 public function __construct()
 {
     //调用父类构造方法
     parent::__construct();
     //1.	注册
     session_set_save_handler(array($this, 'sess_open'), array($this, 'sess_close'), array($this, 'sess_read'), array($this, 'sess_write'), array($this, 'sess_destroy'), array($this, 'sess_gc'));
     //2.	开启session
     @session_start();
 }
开发者ID:BubbleBear,项目名称:www,代码行数:9,代码来源:Session.class.php

示例8: __construct

 /**
  * __construct function.
  *
  * @access public
  * @param mixed $host (default: null)
  * @param mixed $port (default: null)
  * @param mixed $dbname (default: null)
  * @param mixed $username (default: null)
  * @param mixed $password (default: null)
  * @param mixed $charset (default: null)
  * @return void
  */
 public function __construct($username = null, $password = null)
 {
     # set parameters
     $this->set_db_params();
     # rewrite user/pass if requested - for installation
     $username == null ?: ($this->username = $username);
     $password == null ?: ($this->password = $password);
     # construct
     parent::__construct($this->username, $this->password, $this->charset);
 }
开发者ID:rtd,项目名称:phpipam,代码行数:22,代码来源:class.PDO.php

示例9: __construct

	public function __construct($host, $user, $password, $dbname , $connect = false,
			$charset = 'utf8') {
		parent::__construct($host, $user, $password, $dbname , $connect = false,
			$charset = 'utf8');

		$this->logDir = SuiShiPHPConfig::getSqlLogDir();
		$this->logSql = SuiShiPHPConfig::get('ENABLE_SQL_LOG');
		//初始化log file
		$this->iniLogConfig();
	}
开发者ID:neil-chen,项目名称:NeilChen,代码行数:10,代码来源:MySql.class.php

示例10: __construct

 public function __construct()
 {
     parent::__construct();
     if (!session_start()) {
         if (!$this->admin->status() && !preg_match("/^login.*\$/i", $action)) {
             header('Location: ' . BASE_PATH . 'error/session_error/');
             exit;
         }
     }
 }
开发者ID:korvin84,项目名称:test.login,代码行数:10,代码来源:admin.php

示例11:

 function __construct($id = 0)
 {
     parent::__construct();
     if ($id) {
         $this->id = $id;
         $r = $this->getOne($id);
         $this->userid = $r->userid;
         $this->tenderid = $r->tenderid;
         $this->score = $r->score;
     }
 }
开发者ID:andela-egichuri,项目名称:cs258-iiti-group2,代码行数:11,代码来源:tender_user.php

示例12: __construct

 public function __construct($str)
 {
     global $first;
     parent::__construct();
     $this->filter = "*";
     $this->where = "1";
     $this->limit = "0 , 10";
     $this->condition = " ";
     $this->order = "date desc";
     $this->table = $first . $str;
 }
开发者ID:sunpeijun,项目名称:wechat_subscribe,代码行数:11,代码来源:model.php

示例13: __construct

 /**
  * Constructor.  When a instance of the class is loaded it will
  * attempt to find the primary key of the table we are dealing with.
  * If a value is passed to the constructor it will be looked up in
  * the table against the primary key and if a row is found it will
  * be assigned into the object.
  *
  * @access	public
  * @param	mixed	$id					Id to lookup against primary key field
  * @return	void
  */
 public function __construct($id = null)
 {
     parent::__construct();
     if (!is_array($_ENV['describeTable'])) {
         $_ENV['describeTable'] = array();
     }
     # Make sure we have a table to look at
     if (is_null($this->_table)) {
         throw new Exception('No table defined for access in model');
     }
     # Verify Model is not being use directly, and setup _fetchClass
     $class = get_class($this);
     if ($class == 'Model') {
         throw new Exception('Model should not be used directly');
     }
     $this->_fetchClass = $class;
     # Check to see if we've already checked table layout this request
     if (array_key_exists($this->_table, $_ENV['describeTable'])) {
         $this->_key = $_ENV['describeTable'][$this->_table]['key'];
         $this->_metadata = $_ENV['describeTable'][$this->_table]['metadata'];
     } else {
         # Begin process of retrieving table layout
         $sql = "DESCRIBE " . $this->_table;
         $rows = $this->query($sql);
         # If we got back our rows then parse out the data
         if (is_array($rows)) {
             foreach ($rows as $row) {
                 # Format of Type field is "datatype(length) attributes" ex. int(11) unsigned
                 preg_match('/^([a-z]+)\\(([0-9]+)\\)(.*)/i', $row->Type, $matches);
                 $this->_metadata[$row->Field] = new stdClass();
                 if (count($matches) > 0) {
                     $this->_metadata[$row->Field]->type = trim($matches[1]);
                     $this->_metadata[$row->Field]->length = trim($matches[2]);
                     $this->_metadata[$row->Field]->attr = trim($matches[3]);
                     $this->_metadata[$row->Field]->extra = trim($row->Extra);
                 } else {
                     $this->_metadata[$row->Field]->type = $row->Type;
                 }
                 # Check to see if the field we're dealing with is a primary key
                 if (preg_match('/\\bPRI\\b/', $row->Key)) {
                     $this->_key = $row->Field;
                     $this->_metadata[$row->Field]->primary = true;
                 }
             }
         }
         $_ENV['describeTable'][$this->_table] = array('key' => $this->_key, 'metadata' => $this->_metadata);
     }
     # If we know the primary key and have an id, fetch the row
     if (!empty($this->_key) and !is_null($id)) {
         $row = $this->get($id);
     }
 }
开发者ID:uberlinuxguy,项目名称:certis,代码行数:63,代码来源:Model.class.php

示例14: __construct

		public function __construct(){

			parent::__construct();

			session_set_save_handler(
				array($this,'sess_open'),
				array($this,'sess_close'),
				array($this,'sess_read'),
				array($this,'sess_write'),
				array($this,'sess_destroy'),
				array($this,'sess_gc')
			);

			@session_start();
		}
开发者ID:uhgy,项目名称:phppractice,代码行数:15,代码来源:Session.class.php

示例15: __construct

 public function __construct(DBConnect $dbConnect)
 {
     $this->dbConnect = $dbConnect;
     try {
         parent::__construct('mysql:host=' . $dbConnect->getHost() . ';dbname=' . $dbConnect->getDatabase() . ($dbConnect->getCharset() !== null ? ';charset=' . $dbConnect->getCharset() : null), $dbConnect->getUsername(), $dbConnect->getPassword());
         $this->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
         $this->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
         if (($charset = $dbConnect->getCharset()) !== null) {
             $this->query("SET NAMES '" . $charset . "'");
             $this->query("SET CHARSET '" . $charset . "'");
         }
         $this->triggerListeners('onConnect', array($this, $this->dbConnect));
     } catch (\PDOException $e) {
         throw new DBException($e);
     }
 }
开发者ID:timesplinter,项目名称:tsfw-db,代码行数:16,代码来源:DBMySQL.php


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