Created
November 18, 2014 02:33
-
-
Save bran921007/f20eb1915f6322deec72 to your computer and use it in GitHub Desktop.
clase conexion php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Conexion{ | |
private static $objCon = null; | |
private static $instancia = null; | |
public static function obtenerInstancia(){ | |
if(self::$objCon == null){ | |
self::$instancia = new Conexion(); | |
self::$objCon = mysqli_connect("localhost","root","","{1:base_datos}"); | |
} | |
return self::$objCon; | |
} | |
function __destruct(){ | |
mysqli_close(conexion::obtenerInstancia()); | |
} | |
} | |
$rs = conexion::obtenerInstancia(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment