Advertisement
Adriano_back

ConexaoDB

Oct 19th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. <?php
  2. namespace connections;
  3. require_once 'connections/user/defines.php';
  4. use connections\user\defines;
  5.  
  6.  
  7. class ConexaoDB{
  8. private static $conn;
  9.  
  10. const CONEXAO = array("host"=>HOST,"db"=>DATABASE,"user"=>USER,"pass"=>PASSWORD);
  11.  
  12. function __construct(){
  13.     $user = self::CONEXAO['user'];
  14.     $pass = self::CONEXAO['pass'];
  15.     self::$conn = new \PDO('mysql:host='.self::CONEXAO['host'].';dbname='.self::CONEXAO['db'],$user,$pass);
  16.     }
  17.  
  18. public function getConn(){
  19.     return self::$conn;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement