Home  >  Article  >  Backend Development  >  The bridge role of base.php in the secondary development of phpcms_PHP tutorial

The bridge role of base.php in the secondary development of phpcms_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:14:421058browse

PHPCMS is developed using the MVC design pattern, and is accessed based on modules and operations. It adopts a single entry mode for project deployment and access. Regardless of accessing any module or function, there is only one unified entry.

The entry program is a boot program that handles user requests in the early stage. It is the only one that can be run directly upon request by the end user.

PHPCMS framework entry file base.php:

File path: root directory/phpcms/base.php The code snippet is as follows:

This file is the framework entry file, including instantiating system/module class methods, calling system/module methods, common system constants, etc. Such as:

pc_base::load_model('*_model') Load database model class

pc_base::load_sys_class('classname') Instantiate system class

pc_base::load_app_class('classname' ,'admin') Instantiate 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 boot file base.php of the phpcms framework, and then calls its static method creat_app() to create a Web application instance and run it based on the specified configuration file.


Call of database configuration file database.php
File path: root directory/caches/configs/database.php

This code first uses pc_base::load_app_func() to load the function library global.func.php customized by the index module, so that you can call the functions customized by global.func.php as you like. Use the pc_base::load_config() static method to load the database configuration file database.php of phpcms to obtain the database configuration information. This can get rid of the limitations of the PHPCMS framework and use the original PHP mysql for secondary development.

Instantiate module class

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

From this we know that whether we are calling system classes or function libraries in the PHPCMS framework or calling custom module classes or function libraries, we can find the required calling methods in base.php, so PHPCMS II During the first development, it is crucial to understand the static methods in base.php.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440257.htmlTechArticlePHPCMS is developed using the MVC design pattern, accessed based on modules and operations, and uses a single entry mode for project deployment And access, no matter accessing any module or function, only...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn