thinkphp how does the function of the foreground and background public load?

Source: Internet
Author: User
With thinkphp built a website, sub-foreground and backstage (item no group), there are two entrances, front entrance index.php backstage entrance admin.php

I would like to ask, foreground and background common functions, such as how to load, such as the foreground and background will use time function, all about the time function is placed in a lib_time.php this file, how to load the file when the system is running, not when the load


Reply to discussion (solution)

Usually the site has a config file, loaded on the inside can be

Adding in the configuration file
"Load_ext_file" = "User"
Through the above settings, it will be executed automatically load the project public directory common the following extension function library file user.php, so you can directly in the project to call the extension function library user.php function, and the Extension function library function modification is in real time.

Or you can write directly to the common.php file under the Cmmon folder

Write the method directly in the common/commnet.php, the program runs, will automatically load this file, call, the direct method name can be.

Thank you for your help, gave me a big hint, I put the public files loaded in the thinkphp/common/runtime.php, because in the Lib_common the front and back of the public files used in the definition of functions used to C () and M (), Like the execution of these functions are placed in the runtime.php Think::start ();

Adding in the configuration file
"Load_ext_file" = "User"
Through the above settings, it will be executed automatically load the project public directory common the following extension function library file user.php, so you can directly in the project to call the extension function library user.php function, and the Extension function library function modification is in real time. "Load_ext_file" and "User" This section is used in the project configuration file, if the foreground and backstage are used in the user.php function, that can not be user.php copy two copies, put to the front desk and backstage of the two items common/under each other, Do you want to write two copies of the configuration file?

  • 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.