AntonZelenin Posted August 5, 2017 Share Posted August 5, 2017 Here is the code define ('ROOT', __DIR__); require ROOT.'/scripts/autoload.php'; and the file autoload.php function __autoload($class_name) { $array_paths = array( ROOT.'/classes/' ); //another code } And it says that ROOT is undefined. If I define ROOT in autoload.php - it says that constant is already defined. What am I doing wrong?) Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted August 5, 2017 Solution Share Posted August 5, 2017 Either the error message is pointing to a different line than the one you showed or __autoload is running before ROOT was defined. But put that aside for a second and stop using __autoload. Quote Link to comment Share on other sites More sharing options...
AntonZelenin Posted August 5, 2017 Author Share Posted August 5, 2017 Either the error message is pointing to a different line than the one you showed or __autoload is running before ROOT was defined. But put that aside for a second and stop using __autoload. Thanks for advice about __autoload() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.