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?) Link to comment Share on other sites More sharing options...
requinix Posted August 5, 2017 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. 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() Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.