Base d'un site web

This commit is contained in:
Sanchez
2017-04-14 14:31:29 +02:00
committed by mathieu
parent 21c5a759fd
commit e761ff7c5a
29 changed files with 8571 additions and 0 deletions

22
src/Autoloader.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace base;
class Autoloader {
/**
* Enregistre notre autoloader
*/
static function register(){
spl_autoload_register(array(__CLASS__, 'autoload'));
}
/**
* Inclue le fichier correspondant à notre classe
* @param $class string Le nom de la classe à charger
*/
static function autoload($class){
if (preg_match('#^' . Config::NAMESPACE . '\\\(.+)$#', $class, $matches))
require 'src/' . str_replace('\\', '/', $matches[1]) . '.php';
}
}