What's wrong with solving the code below?

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.