Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Basic application enviroment
- * BASEPATH constant uses as script access control, so One doesn't have to
- * put .htaccess file in every class folder
- */
- define('BASEPATH', '/');
- /**
- * Use it as main application wrapper, where configures, initializes and
- * run your app
- */
- final class App
- {
- private $conf;
- /**
- * Initialize and configures applications
- */
- public function initApp()
- {
- spl_autoload_register(array($this,'loadClass'));
- $this->conf = Config::getConfigData( 'db' );
- }
- /**
- * Load all needed classes - called by spl_autoload register
- */
- private function loadClass( $name )
- {
- $classes = array(
- 'Utils' => 'utils/Utils.php',
- 'Config' => 'config/Config.php'
- );
- if ( !key_exists($name, $classes ) )
- {
- die("Can't find " . $name . " class!");
- }
- require_once($classes[$name]);
- }
- }
- $app = new App();
- $app->initApp();
- Utils::dumpVar(App::$conf);
- $db = new PDO($dsn, $username, $passwd, $options);
Advertisement
Add Comment
Please, Sign In to add comment