The Easiest Way to Save and Share Code Snippets on the web

Class 1

php-brief

posted: Jun, 18th 2012 | jump to bottom

<?php
 
//config.php
 
define("db_driver","mysql");
 
//db.interface.php
 
interface DB {
  function connect();
  function execute();
  function close();
}
 
//mysql.class.php
 
class MySQL extends ORM implements DB  {
  function connect() {
    mysql_connect("localhost","usuario","senha");
  }
  function execute() {}
  function close() {}
  function nomedometodo() {} 
}
 
//postgresql.class.php
 
class PostgreSQL extends ORM implements DB {
  function connect() { 
    pg_connect("host=localhost username=usuario password=senha");
  }
  function seila() {}
  function execute() {}
  function close() {}
}
 
//orm.class.php
 
class ORM {
 
}
 
 
 
//index.php
 
$db = new ReflectionClass(db_driver);
 
4740 views