autoloader.php (548B) download
1<?php
2
3spl_autoload_register(function ($class_name) {
4 if (DIRECTORY_SEPARATOR != "\\") {
5 $class_name = str_replace("\\", DIRECTORY_SEPARATOR, $class_name);
6 }
7
8 $sr = DIRECTORY_SEPARATOR;
9 $filename = $class_name . '.php';
10 if (!file_exists($filename)) {
11 $filename = 'Model' . $sr . $class_name . '.php';
12 if (!file_exists($filename)) {
13 return false;
14 } else {
15 include 'Model' . $sr . $class_name . '.php';
16 }
17 } else {
18 include $class_name . '.php';
19 }
20});