I am using a php framework (not a common one) and I am running into an issue. Whenever I add a sub-folder, my framework cannot be found. For instance, here is what my folder structure looks like.
+
= file
-account
-classes
-core
+index
+register
I have an init file within my core folder that works perfectly fine with files within the root, but when I am in files with the account folder (files for when logged in) it throws errors.
I have the following in my init file to call the classes.
spl_autoload_register(function($class) {
require_once 'classes/' . $class . '.php';
});
require_once 'functions/sanitize.php';
So normally I do this to call the init file:
require_once 'core/init.php';
I have tried doing this
require_once '/core/init.php';
I get this error:
Warning: require_once(/core/init.php): failed to open stream: No such file or directory
Then when I do this
require_once 'http://sitename.com/core/init.php';
The init file works, but then the path to all of my classes does not work.
Do I need to do something with my init file, specifically these lines:
spl_autoload_register(function($class) {
require_once 'classes/' . $class . '.php';
});
require_once 'functions/sanitize.php';
To allow it to work for root files and sub-folder files?