Home Backend Development PHP Tutorial ThinkPHP project group configuration_PHP tutorial

ThinkPHP project group configuration_PHP tutorial

Jul 14, 2016 am 10:10 AM
thinkphp Group Function Can Bundle yes mechanism Overview of Configuration important project

Project grouping overview:
Project grouping is an important mechanism of ThinkPHP. The project grouping function can merge multiple previous projects into one project group. Public files can be reused, and each group can have its own independent configuration files, public files, and language packs. wait.
Taking an ordinary website as an example, if project grouping is not used, the website frontend (the browsing part provided to users) is usually treated as a project. The backend management part of the website may have independent configuration files, CSS files, templates, etc., so it is managed as another project. But in fact, both projects are the content of the website, and they can share some content such as database configuration files and even some model classes and cross-project operations.
Project grouping can well solve the commonality and individuality issues between projects under the same system.

Project grouping configuration:
Perform simple project grouping configuration in the system configuration file (Config/config.php) to enable project grouping.
There are five configurations related to project grouping mode:

Description and examples or suggestions for configuration options:
APP_GROUP_LIST: A list of all names of the project group. If not set, it means that the project grouping mode is not enabled, for example, 'APP_GROUP_LIST'=>'Home,Admin,User,Blog',
DEFAULT_GROUP: The default project group name, the system default is Home, for example, 'DEFAULT_GROUP' =>'Home',
APP_GROUP_DEPR: The delimiter between project groups, the default is . (dot), used for separation in A function, D function and routing configuration, it is recommended to default to
​ TMPL_FILE_DEPR: The separator between the module and the operation in the template file. The default is /. It is only valid for project group deployment. It is recommended to default. You can use the U method to automatically generate URL
VAR_GROUP: Variable to obtain the project group name, the default is g, for example index.php?g=Admin&m=Index&a=edit, it is recommended to default

When TMPL_FILE_DEPR is configured as _, in terms of Admin group Index module add operation, the corresponding template file is changed from the original:
Tpl/default/Admin/Index/add.html
Changed to:
Tpl/default/Admin/Index_add.html
Through this configuration, the template directory structure is reduced by one directory.
Tip: TMPL_FILE_DEPR is also the delimiter between the grouped language definitions and the language file in the language file.
Among the above configuration options, to enable grouping, APP_GROUP_LIST must be set, and other options must be configured according to the actual situation.

Project grouping personalized configuration:
If you want to add a unique personalized configuration to a grouped project, you can create a directory with the same name as the project group under the configuration directory Conf (the directory naming format is: the first letter of the group name is in uppercase + the remaining letters are in lowercase), and Define a config.php configuration file in the directory. Such as the personalized configuration file of the Admin project:
Conf/Admin/config.php
When there is a config.php file defined in the directory with the group name, every time the group is accessed, the system will automatically load the independent configuration of the group and overwrite the settings of the same options in the public configuration.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477579.htmlTechArticleOverview of project grouping: Project grouping is an important mechanism of ThinkPHP. The project grouping function can merge multiple previous projects into one In the project team, public files can be reused...
Statement of this Website
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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Apr 09, 2024 pm 03:20 PM

Fermat's last theorem, about to be conquered by AI? And the most meaningful part of the whole thing is that Fermat’s Last Theorem, which AI is about to solve, is precisely to prove that AI is useless. Once upon a time, mathematics belonged to the realm of pure human intelligence; now, this territory is being deciphered and trampled by advanced algorithms. Image Fermat's Last Theorem is a "notorious" puzzle that has puzzled mathematicians for centuries. It was proven in 1993, and now mathematicians have a big plan: to recreate the proof using computers. They hope that any logical errors in this version of the proof can be checked by a computer. Project address: https://github.com/riccardobrasca/flt

How to run thinkphp project How to run thinkphp project Apr 09, 2024 pm 05:33 PM

To run the ThinkPHP project, you need to: install Composer; use Composer to create the project; enter the project directory and execute php bin/console serve; visit http://localhost:8000 to view the welcome page.

There are several versions of thinkphp There are several versions of thinkphp Apr 09, 2024 pm 06:09 PM

ThinkPHP has multiple versions designed for different PHP versions. Major versions include 3.2, 5.0, 5.1, and 6.0, while minor versions are used to fix bugs and provide new features. The latest stable version is ThinkPHP 6.0.16. When choosing a version, consider the PHP version, feature requirements, and community support. It is recommended to use the latest stable version for best performance and support.

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

Steps to run ThinkPHP Framework locally: Download and unzip ThinkPHP Framework to a local directory. Create a virtual host (optional) pointing to the ThinkPHP root directory. Configure database connection parameters. Start the web server. Initialize the ThinkPHP application. Access the ThinkPHP application URL and run it.

Which one is better, laravel or thinkphp? Which one is better, laravel or thinkphp? Apr 09, 2024 pm 03:18 PM

Performance comparison of Laravel and ThinkPHP frameworks: ThinkPHP generally performs better than Laravel, focusing on optimization and caching. Laravel performs well, but for complex applications, ThinkPHP may be a better fit.

How to install thinkphp How to install thinkphp Apr 09, 2024 pm 05:42 PM

ThinkPHP installation steps: Prepare PHP, Composer, and MySQL environments. Create projects using Composer. Install the ThinkPHP framework and dependencies. Configure database connection. Generate application code. Launch the application and visit http://localhost:8000.

How is the performance of thinkphp? How is the performance of thinkphp? Apr 09, 2024 pm 05:24 PM

ThinkPHP is a high-performance PHP framework with advantages such as caching mechanism, code optimization, parallel processing and database optimization. Official performance tests show that it can handle more than 10,000 requests per second and is widely used in large-scale websites and enterprise systems such as JD.com and Ctrip in actual applications.

Computer configuration recommendations for building a high-performance Python programming workstation Computer configuration recommendations for building a high-performance Python programming workstation Mar 25, 2024 pm 07:12 PM

Title: Computer configuration recommendations for building a high-performance Python programming workstation. With the widespread application of the Python language in data analysis, artificial intelligence and other fields, more and more developers and researchers have an increasing demand for building high-performance Python programming workstations. When choosing a computer configuration, in addition to performance considerations, it should also be optimized according to the characteristics of Python programming to improve programming efficiency and running speed. This article will introduce how to build a high-performance Python programming workstation and provide specific

See all articles