Make autoload with PHP without using namespace

0

I'm having a class-heavy problem in my project, my class structure:

/sistema/
- /inc/
 - header.php
- /classes/
- /views/
- Autoload.php
- index.php

this Autoload.php has:

<?php

class Autoload {

   public function __construct() {
      spl_autoload_extensions('.php');
      spl_autoload_register(array($this, 'load'));
}

  private function load($className) {
      $extension = spl_autoload_extensions();
      require_once (__DIR__ . '/classes/' . $className . $extension);
  }

}

The problem is occurring because in inc/header.php I give a require_once 'Autoload.php'; when it is in the initial page it does not of the problem, now when I call a page that is inside Views it of error, my whole system depends on header.php and header.php'' depende de Autoload.php '.

In other words, I am not able to call views , which will load my classes.

I'm not using namespaces in my classes.

    
asked by anonymous 13.11.2018 / 13:50

0 answers