05.
Autoloading Awesomeness
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
3 Comments
I am not sure, but I think the autoloader won't work on Windows because this system uses backslashes ('\'), not slashes ('/') in its path.
To fix this you can replace '/' in the code with `DIRECTORY_SEPARATOR` PHP constant, that will give you a relevant separator for your system.
Hope it helps someone!
Hey Serge,
Thanks for mentioning DIRECTORY_SEPARATOR constant. It could be useful in some cases, e.g. some functions return path with specific slash ("/" or "\") depends on OS and that's the case where that constant could be useful if you want to explode the path etc. But Windows already understand both slashes.
Cheers!
No problem! Thanks for clarifying the issue.
"Houston: no signs of life"
Start the conversation!