Невозможно использовать spl_autoload_register для загрузки классов в PHP ⇐ Php
-
Anonymous
Невозможно использовать spl_autoload_register для загрузки классов в PHP
I just encountered an error while programming PHP. The thing is that I used spl_autoload_register inside the init.php file but could not load the classes inside the classes folder. I make sure that the classes inside the files in the classes folder have the same name as the file name. And if I don't use spl_autoload_register and include_once on each file, it works (I commented the included_once files manually). Please give me a solution. Here is my directory structure:
This is my project folder structure
Here is the code inside the init.php file:
I tried changing the available paths, but it didn't seem to work the way I wanted, I also thought maybe I had the wrong path
Источник: https://stackoverflow.com/questions/780 ... ses-in-php
I just encountered an error while programming PHP. The thing is that I used spl_autoload_register inside the init.php file but could not load the classes inside the classes folder. I make sure that the classes inside the files in the classes folder have the same name as the file name. And if I don't use spl_autoload_register and include_once on each file, it works (I commented the included_once files manually). Please give me a solution. Here is my directory structure:
This is my project folder structure
Here is the code inside the init.php file:
I tried changing the available paths, but it didn't seem to work the way I wanted, I also thought maybe I had the wrong path
Источник: https://stackoverflow.com/questions/780 ... ses-in-php