daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Oct 13th, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // Автозагрузка классов
  4. spl_autoload_register ( function ($class_name) {
  5.   $filename = strtolower($class_name) . '.php';
  6.   $file = __DIR__ . DIRSEP . 'classes' . DIRSEP . $filename;
  7.   if (file_exists($file) == false) {
  8.     return false;
  9.   }
  10.   include ($file);
  11. });
  12.  
  13.  
  14. // Автозагрузка классов. Пути из массива
  15. function __autoload($className) {
  16.  
  17.   $arrayPatch = [
  18.   '/core/classes/',
  19.   '/core/controllers/',
  20.   '/core/views/'
  21.   ];
  22.  
  23.   foreach ($arrayPatch as $patch) {
  24.     $patch = ROOT . $patch . $className . '.php';
  25.     if (is_file($patch)) {
  26.       include $patch;
  27.     }
  28.   }
  29. }
RAW Paste Data
Top