dibi::connect PHP Method

connect() public static method

Creates a new Connection object and connects it to specified database.
public static connect ( $config = [], $name ) : Dibi\Connection
return Dibi\Connection
    public static function connect($config = [], $name = 0)
    {
        return self::$connection = self::$registry[$name] = new Dibi\Connection($config, $name);
    }

Usage Example

示例#1
0
 /**
  * Spoji se z databzi.
  *
  * @return Bobr_Bobr
  * @throws DibiDriverException
  */
 private function connectToDatabase()
 {
     // @todo odchytavat vyjimku pri nepovedenem spojeni.
     $config = new Config();
     $connect = dibi::connect(array('driver' => 'postgre', 'string' => ' host=' . $config->dbHost . ' port=' . $config->dbPort . ' dbname=' . $config->dbName . ' user='******' password='******'', 'persistent' => $config->dbPersistent), $config->dbConnectionName);
     return $this;
 }
All Usage Examples Of dibi::connect