Home Backend Development PHP Tutorial LotusPhp recommended program directory_PHP tutorial

LotusPhp recommended program directory_PHP tutorial

Jul 20, 2016 am 11:14 AM
fixed recommend Format flexible of Table of contents relatively program project

A good project will have a fixed format directory. Lotusphp is relatively more flexible and you can reasonably arrange your own program running directory. Here I recommend two directory setting structures

The first is the directory structure recommended by Lotusphp. First, make sure that the server has enabled the parent directory reference function, or guide it to wwwroot/frontend through rewrite (but this is not recommended because there may be multiple applications, unless you just An application, directed to index.php by default)

├─framework
├─app
│  └─frontend                      应用名称
│      ├─action
│      ├─conf
│      ├─lib
│      └─view
│          └─layout
├─conf
│  ├─dev
│  └─standard
├─lib
│  ├─Dao
│  ├─Util
│  └─Service
└─wwwroot
    └─frontend
Copy after login

Everyone can understand at a glance that wwwroot is the web root directory. All program running files, including frameworks, programs, class libraries, plug-ins, configuration files, etc. are in the parent directory of wwwroot. Even if it is hacked, it will only be hacked. If the server is disconnected and you simply browse from the web server, you cannot see any program files and class libraries. Only pictures, scripts and other resources can be accessed in the wwwroot directory. The safety factor of such a configuration is relatively high. The top app folder is the application folder. Multiple applications can be created below. Generally, we often have one application in the foreground and one application in the background. Two applications are enough. For complex logic, the number of applications can be defined as needed. , the names of the corresponding folders in wwwroot and the folders corresponding to the app should be the same. The background program files stored in the app, while the files stored in wwwroot should be foreground scripts, pictures, styles and other files. There are several folders under the application directory. The corresponding function distribution is action, which corresponds to the application file, which is responsible for parsing the background logic part. conf has defined the configuration file of the application, lib is the definition plug-in, and various common functions used by the application. Class library, Dao data table class, view stores views, which can also be understood as what we often call templates. The subfolder layout is where layout view files are stored

The conf directory stores configuration files. The dev directory below is the configuration file used in development mode, while standard is the configuration file stored in production mode. For a simple example, the database configurations on the local and server are different. If the configuration is the same, you can save it as different configurations, enable development mode locally, and transfer it to the server to enable production mode, so you can easily cope with different operating environments. All configuration files are placed in the conf directory. Global configuration is a configuration shared by all applications. Each application's special configuration is placed in conf in the application name directory. In the production environment, only the standard configuration is loaded. In the development mode, the standard configuration is loaded first, and then the development configuration is loaded, overwriting the same ones in the standard configuration.

The lib directory stores some basic class libraries. Plug-ins outside the framework can also be stored here. After lotus is declared, this folder will be automatically loaded, and all class libraries and functions in it will be automatically loaded. , Dao stores the classes declared in the data table, Util stores commonly used functions and class libraries, and Service stores some complex logic class libraries of the program. For example, we often log in in the background and need to judge the legitimacy of the user. Written as a class library, a check method of the class library is called in the action to determine whether the user is legal.

You can put your own defined PHP classes in the lib and action directories and use them directly in other places without include/require statements. The autoloader component will automatically load the classes used, which is loading on demand.

The directory structure and file names in the lib and action directories are arbitrary, as long as the class names are unique, the current autoloader does not use the name space feature of php5.3.

Please note that in the lotusphp running directory, except for the files in the conf and view folders, other files must exist in the form of classes or functions.

There is also a directory structure for those who cannot open parent directory references. Generally, there are many applications in virtual hosts

wwwroot
├─cache
├─framework
├─runtime
│  ├─app
│  │  └─frontend
│  │      ├─action
│  │      ├─conf
│  │      ├─lib
│  │      └─view
│  │          └─layout
│  ├─conf
│  │  ├─dev
│  │  └─standard
│  └─lib
└─static
Copy after login

cache is the cache directory. Many people ask why the first structure above does not set this folder. Because the above structure is suitable for your own server, the cache can be set to the folder you set. You can even set it into the memory, but it is impossible for the virtual host to give you this permission. You can only set it in your own directory, so I added a directory like this. Runtime is the directory where the program runs files, and static is where style sheets and scripts are stored. , picture file. The functions of other directories are the same as above.

These two recommended directory methods are basically suitable for most people’s needs.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440304.htmlTechArticleA good project will have a fixed format directory. Lotusphp is relatively more flexible and can reasonably arrange the running directory of your own program. , here I recommend two directory setting structures. The first one is...
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

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.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

How to make Google Maps the default map in iPhone How to make Google Maps the default map in iPhone Apr 17, 2024 pm 07:34 PM

The default map on the iPhone is Maps, Apple's proprietary geolocation provider. Although the map is getting better, it doesn't work well outside the United States. It has nothing to offer compared to Google Maps. In this article, we discuss the feasible steps to use Google Maps to become the default map on your iPhone. How to Make Google Maps the Default Map in iPhone Setting Google Maps as the default map app on your phone is easier than you think. Follow the steps below – Prerequisite steps – You must have Gmail installed on your phone. Step 1 – Open the AppStore. Step 2 – Search for “Gmail”. Step 3 – Click next to Gmail app

Convert VirtualBox fixed disk to dynamic disk and vice versa Convert VirtualBox fixed disk to dynamic disk and vice versa Mar 25, 2024 am 09:36 AM

When creating a virtual machine, you will be asked to select a disk type, you can select fixed disk or dynamic disk. What if you choose fixed disks and later realize you need dynamic disks, or vice versa? Good! You can convert one to the other. In this post, we will see how to convert VirtualBox fixed disk to dynamic disk and vice versa. A dynamic disk is a virtual hard disk that initially has a small size and grows in size as you store data in the virtual machine. Dynamic disks are very efficient at saving storage space because they only take up as much host storage space as needed. However, as disk capacity expands, your computer's performance may be slightly affected. Fixed disks and dynamic disks are commonly used in virtual machines

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

Clock app missing in iPhone: How to fix it Clock app missing in iPhone: How to fix it May 03, 2024 pm 09:19 PM

Is the clock app missing from your phone? The date and time will still appear on your iPhone's status bar. However, without the Clock app, you won’t be able to use world clock, stopwatch, alarm clock, and many other features. Therefore, fixing missing clock app should be at the top of your to-do list. These solutions can help you resolve this issue. Fix 1 – Place the Clock App If you mistakenly removed the Clock app from your home screen, you can put the Clock app back in its place. Step 1 – Unlock your iPhone and start swiping to the left until you reach the App Library page. Step 2 – Next, search for “clock” in the search box. Step 3 – When you see “Clock” below in the search results, press and hold it and

A closer look at PyCharm: a quick way to delete projects A closer look at PyCharm: a quick way to delete projects Feb 26, 2024 pm 04:21 PM

Title: Learn more about PyCharm: An efficient way to delete projects. In recent years, Python, as a powerful and flexible programming language, has been favored by more and more developers. In the development of Python projects, it is crucial to choose an efficient integrated development environment. As a powerful integrated development environment, PyCharm provides Python developers with many convenient functions and tools, including deleting project directories quickly and efficiently. The following will focus on how to use delete in PyCharm

How to recommend friends to me on Taobao How to recommend friends to me on Taobao Feb 29, 2024 pm 07:07 PM

In the process of using Taobao, we will often be recommended by some friends we may know. Here is an introduction to how to turn off this function. Friends who are interested should take a look. After opening the "Taobao" APP on your mobile phone, click "My Taobao" in the lower right corner of the page to enter the personal center page, and then click the "Settings" function in the upper right corner to enter the settings page. 2. After coming to the settings page, find "Privacy" and click on this item to enter. 3. There is a "Recommend friends to me" on the privacy page. When it shows that the current status is "on", click on it to close it. 4. Finally, in the pop-up window, there will be a switch button behind "Recommend friends to me". Click on it to set the button to gray.

PyCharm Practical Tips: Convert Project to Executable EXE File PyCharm Practical Tips: Convert Project to Executable EXE File Feb 23, 2024 am 09:33 AM

PyCharm is a powerful Python integrated development environment that provides a wealth of development tools and environment configurations, allowing developers to write and debug code more efficiently. In the process of using PyCharm for Python project development, sometimes we need to package the project into an executable EXE file to run on a computer that does not have a Python environment installed. This article will introduce how to use PyCharm to convert a project into an executable EXE file, and give specific code examples. head

How to write the qq mailbox format? What is the qq mailbox format? How to write the qq mailbox format? What is the qq mailbox format? Feb 22, 2024 pm 03:40 PM

QQ email: QQ number@qq.com, English QQ email: English or numbers@qq.com, foxmail email account: set up your own account@foxmail.com, mobile phone email account: mobile phone number@qq.com. Tutorial Applicable Model: iPhone13 System: IOS15.3 Version: QQ Mailbox 6.3.3 Analysis 1QQ mailbox has four formats, commonly used QQ mailbox: QQ number@qq.com, English QQ mailbox: English or numbers@qq.com, foxmail Email account: set up your own account@foxmail.com, mobile phone email account: mobile phone number@qq.com. Supplement: What is qq mailbox? 1 The earliest QQ mailbox was only between QQ users

See all articles