What would be best way to use this, as you have seen the usage in Zend Framework, they have got really simple way to do this. All the class names contain the path in names. Like it would be: My_Database_Mysql so this means it's located in folder My/Database/Mysql.php. You could use your own delimiter (- . :).
As the zip with php files isn't allowed to upload so explain the scheme of directories.
/library/Database/Mysql/Pd
/library/Database/Mysql/My
/library/Database/Mysql/De
/library/Database/Oracle/D
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: |
<?php
set_include_path('./library');
function __autoload($className) {
$path = str_replace('_', '/', $className);
require_once("{$path}.php");
}
$pdo = new Database_Mysql_Pdo();
var_dump($pdo);
$mysqli = new Database_Mysql_Mysqli();
var_dump($mysqli);
?> |