is a piece of code for PHP to automatically load files
public static function Userautoload ($class _name) {//First processing determined (core class in the framework)//class name and class file mapping array $ Framework_class_list = Array (//' class name ' = = ' class file address ' Controller ' = = Framework_path. ' Controller.class.php ', ' Model ' = Framework_path. ' Model.class.php ', ' Factory ' = Framework_path. ' Factory.class.php ', ' mysqldb ' = Framework_path. ' MySQLDB.class.php ', ' sessiondb ' = Tool_path. ' SessionDB.class.php ');//Determine if the core class if (Isset ($framework _class_list[$class _name])) {//is the core class require $framework _class_ list[$class _name];} Judging whether it is possible to add (Controller class, Model Class)//Controller class, Intercept is a character, match Controllerelseif (substr ($class _name, -10) = = ' Controller ') {//Controller class, Current platform under CONTROLLER directory require Current_controller_path. $class _name. '. class.php ';} Model class, truncated after 5 characters, matching Modelelseif (substr ($class _name,-5) = = ' model ') {//model class, current platform below model directory require Current_model_path. $ Class_name. '. class.php ';}} /** * Registration automatically loads */private static function _initautoload () {spl_autoload_register (Array (__class__, ' userautoload '));}]
Reply to discussion (solution)
Where did you call the _initautoload method?
Where did you call the _initautoload method?
Called by Static::_initautoload in another method of the current class.
Resolved is automatic load case issue