The role of base. php In secondary development of phpcms

Source: Internet
Author: User

PHPCMS is developed in the MVC design mode and accessed through modules and operations. It uses a single portal mode for project deployment and access, regardless of the access to any module or function, there is only one unified portal.

The portal program is the Bootstrap program that processes user requests in the early stage. It is the only one that can be directly requested by the end user to run.

PHPCMS framework entry file base. php:

File Path: root directory/phpcms/base. php code snippet:

This file is the framework entry file, including instantiation system/module class methods, Calling System/module methods, and common system constants. For example:

Pc_base: load_model ('* _ model') load database model class

Pc_base: load_sys_class ('classname') instantiate the system class

Pc_base: load_app_class ('classname', 'admin') instantiate the module class

Pc_base: load_sys_func ('funcfile ') Call the system function library

Pc_base: load_sys_func ('global', 'test'); // load the module function library (call the global function package of the test Module)


Instantiate an application
File Path: root directory/index. php

This code first loads the phpcms Framework's boot file base. php, and then calls its static method creat_app () to create and run a Web application instance based on the specified configuration file.


Database Configuration File database. php call
File Path: root directory/caches/configs/database. php

This code first uses pc_base: load_app_func () to load the index module's custom function library global. func. php. func. php UDF. Use the pc_base: load_config () Static Method to load the database configuration file database of phpcms. php to get the configuration information of the database, so that you can get rid of the limitations of the PHPCMS framework and use the original PHP mysql for secondary development.

 

Instantiate a module class

This Code uses the pc_base: load_app_class () method to instantiate the admin. class of the admin module.

From this we know that, whether we call the system class or function library in the PHPCMS framework or call a custom module class or function library, we can all go to the base. php to find the call method, so the second development of PHPCMS, find out the base. static Methods in php are crucial.

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.