Created
February 19, 2009 11:50
-
-
Save masakielastic/66881 to your computer and use it in GitHub Desktop.
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
<?php | |
class Autoload | |
{ | |
static public function loadClass($className) | |
{ | |
require_once($className . '.class.php'); | |
} | |
static public function getInstance() | |
{ | |
spl_autoload_register(array(self, 'loadClass')); | |
} | |
} | |
// usage | |
Autoload::getInstance(); | |
// symfony | |
require_once 'symfony/autoload/sfCoreAutoload.class.php'; | |
sfCoreAutoload::register(); | |
// Zend Framework | |
require_once 'Zend/Version.php'; | |
if(Zend_Version::compareVersion('1.8.0')>=0) | |
{ | |
require_once 'Zend/Loader/Autoloader.php'; | |
Zend_Loader_Autoloader::getInstance(); | |
} | |
else | |
{ | |
require_once 'Zend/Loader.php'; | |
Zend_Loader::registerAutoload(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment