Created
May 16, 2011 13:05
-
-
Save lleitep3/974406 to your computer and use it in GitHub Desktop.
my default bootstrap
This file contains 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 | |
session_start(); | |
date_default_timezone_set ('America/Sao_Paulo'); | |
define ('DS', DIRECTORY_SEPARATOR); | |
define ('URL', "http://".$_SERVER['SERVER_NAME']); | |
define ('ENVIRONMENT' , 'DEV'); | |
spl_autoload_register('autoload'); | |
function autoload($className) | |
{ | |
$className = ltrim($className, '\\'); | |
$fileName = ''; | |
$namespace = ''; | |
if ($lastNsPos = strripos($className, '\\')) { | |
$namespace = substr($className, 0, $lastNsPos); | |
$className = substr($className, $lastNsPos + 1); | |
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; | |
} | |
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; | |
require $fileName; | |
} | |
if (ENVIRONMENT == 'DEV') | |
error_reporting(E_ALL); | |
else | |
error_reporting(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment