How CI implements indirect inheritance

Source: Internet
Author: User
When:
Class My_controller extends ci_controller{....}

Controller folder:
Class Add_shop extends my_controller{....}

This is all normal and able to access my methods and properties for customizing My_controller and framework Ci_contorller

However, I would like to achieve:
Class My_controller extends ci_controller{....}
Class My_shop_base extends My_controller {...}

Controller folder:
Class Add_shop extends My_shop_base {...}

Like this to indirectly inherit Ci_controller, but the project will be error: Fatal error:class ' my_shop_base ' not found


Reply to discussion (solution)

Obviously, you didn't load the definition of my_shop_base when you defined Add_shop.

Obviously, you didn't load the definition of my_shop_base when you defined Add_shop.


Positive solution, sometimes complicate the framework will forget the basic principle of PHP ~

Note: You can find relevant code for loading custom classes in Ci/lib/codeigniter.
  • 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.