[PHP learning]--1 · First acquaintance with Thinkphp3.2

Directory Structure
www WEB deployment directory (or subdirectory)
├─index.php entry file
├─Application application directory
├─Public resource file directory
├─ThinkPHP framework system directory (can be deployed under non-web directory)
│ ├─Common core public function directory
│ ├─Conf core configuration directory
│ ├─Lang core language package directory
│ ├─Library framework class library directory
│ │ ├─Think core Think class library package directory
│ │ ├─Behavior behavior class library directory
│ │ ├─Org Org class Library package directory
│ │ ├─Vendor third-party class library directory
│ │ ├─ ... more class library directory
│ ├─Mode framework application mode directory
│ ├─Tpl system template directory
│ ├─LICENSE.txt framework license agreement file
│ ├─logo.png Framework LOGO file
│ ├─README.txt Framework README file
│ └─index.php Framework entry file
Entry file definition
Default configuration
// Enable debug mode, it is recommended to enable deployment phase comments or set to false in the development phase
define('APP_DEBUG',True);
// Define the application directory
define('APP_PATH','./Application/');
// Introduce ThinkPHP Entry file
require './ThinkPHP/ThinkPHP.php';
:

// To enable debug mode, it is recommended to open the deployment phase comments in the development phase or set it to false
define('APP_DEBUG',True);
// Define the application directory
define('APP_PATH','./Application/');
// Introduce the ThinkPHP entry file
require './ThinkPHP/ThinkPHP.php';
Accessing the application entry file for the first time
will display the default welcome page as shown

:)

Welcome to ThinkPHP !

And automatically create the following directory structure
Application
├─Common application common module
│ ├─Common application public function directory
│ ├─Conf application public configuration file directory
│ └─index.html directory security file
├─Home Default generated Home module
│ ├─Conf module configuration file directory
│ ├─Common module function public directory
│ ├─Controller module controller directory
│ ├─Model module model directory
│ ├─View module view file directory
│ └─index.html directory security file
├─Runtime runtime directory
│ ├─Cache template Cache Directory│
├─Data Data Directory│
├─Logs Log Directory│
├─Temp Cache Directory│
└─index.html Directory Security File
Directory security file can be modified or disabled in the entry file
//修改目录安全文件
define('DIR_SECURE_FILENAME', 'default.html');
//禁用目录安全文件
define
('BUILD_DIR_SECURE', false);

module

Application default application directory (can be set)
├─Common public module (can not be directly accessed)
├─Home front module
├─Admin background module├─
... Other more modules
├─Runtime default runtime directory (can be set)
Each module is relatively independent, and its directory structure is as follows:
Application
│ Various modules
│ ├─Conf configuration file directory
│ ├─Common public function directory
│ ├─Controller controller directory
│ ├─Model model directory
│ ├─Logic logic directory (optional)
│ ├─Service Service directory (optional ) )
│ ... more hierarchical directories optional
│ └─View view directory

Controller
/**  * The naming method of the controller file is: class name + class.php (class file suffix)  * Such as the default home page controller file IndexController.class.php  */ // namespace namespace Home\Controller; //Introduce the Think\Controller namespace to facilitate the direct use of use Think\Controller; //The naming method of the controller class is: controller name (CamelCase, the first Capital letters) + Controller class IndexController extends Controller










Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324480858&siteId=291194637