thinkphp How to extend the core class?

Source: Internet
Author: User
thinkphp How to extend the core class? For example, I want to extend the routing class, inherit thinkphp's core routing class first, and then let thinkphp run my extended routing class instead of the original core routing class?

25 points left, help ah ~ ~


Reply to discussion (solution)

Extending the core class that means you need to refer to the part of your own to call your own. Remove the default for the frame, as far as the extended file is going to look at yourself, the point is that you need to find out where his routing control was introduced.

Extending the core class that means you need to refer to the part of your own to call your own. Remove the default for the frame, as far as the extended file is going to look at yourself, the point is that you need to find out where his routing control was introduced.



The introduction of the place is also the core class, if the direct replacement, it moved the core of TP class, is not want to move TP core class, just want to expand, or directly to the TP routing class


Extending the core class that means you need to refer to the part of your own to call your own. Remove the default for the frame, as far as the extended file is going to look at yourself, the point is that you need to find out where his routing control was introduced.



The introduction of the place is also the core class, if the direct replacement, it moved the core of TP class, is not want to move TP core class, just want to expand, or directly to the TP routing class

Then you can add a configuration and then in the core class to add a judgment, if the configuration using TP from the original call TP, otherwise call yourself custom not good.

Please read carefully the chapter on "Behavior extension" in the manual.

  • Related Article

    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.