I find it kind of weird that spl_autoload uses this functionality for namespaces. Numerous places online I've read mentioned that spl will look at the namespace and attempt to load it based on the namespace as if it were a directory structure.
http://www.dreamincode.net/forums/topic/148935-php-53-namespacing-and-autoloading/ Example of autoloading with namespaces. Though this is done on windows though, not linux.
Guess I will just specify a function to load it. Thanks.
I did a search on the forums before posting this So I have been attempting to use spl_autoload_extensions('.php') to autoload my classes based off namespaces but it continually says that the namespace does not exist.
Code I am using:
spl_autoload_extensions('.php');
spl_autoload_register();
use Test\Systems\User as User;
$usr = new User();
The error I get is this: Class Test\Systems\User could not be loaded in..
My files are exactly as named in the namespace. So
Test > Systems > User.php
I have also tried variations of that like:
spl_autoload_extensions('.php');
spl_autoload_register();
use Test\Systems as Test;
$usr = new Test\User();
And so on. Nothing appears to be working.
I looked around online and seen that at one point *nix systems couldn't use autoloading but apparently php 5.3.3 fixed this functionality. The server currently is running on 5.3.13 so I am not sure why this isn't working.
Any insight would be appreciated.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.