Home  >  Article  >  php教程  >  [ThinkPHP Series] Introduction and construction of the ThinkPHP framework (1)

[ThinkPHP Series] Introduction and construction of the ThinkPHP framework (1)

黄舟
黄舟Original
2016-12-28 10:32:001927browse

What is ThinkPHP?

MVC(M: module; V: view; C: controller)
Fast and simple object-oriented lightweight framework;
Rich API;
Encapsulated database CURD is simple to operate Easy to use;
Easy to expand, domestic team development, complete documentation and tutorials

ThinkPHP framework construction

a) Download the ThinkPHP package: http://www.thinkphp.cn/down .html (it is recommended to choose version: 3.2.*)
b) Put the downloaded framework package into the directory of the server
c) Understand the role of each directory in ThinkPHP

www (服务器目录)
|-index.php    入口文件
|-README.md    README文件
|-Application  应用目录(存放项目的内容)
|-Public       资源文件目录
|-ThinkPHP     框架系统目录(可以部署在非web目录下)
|-Common       核心公共函数目录
|-Conf         核心配置目录
|-Lang         核心语言包目录
|-Library      框架类库目录
| |-Think      核心Think类库包目录
| |-Behavior   行为类库目录
| |-Org        Org类库包目录
| |-Vendor     第三方类库目录
| |- …
|-Mode         框架应用模式目录
|-Tpl          系统模板目录
|-LICENSE.txt  框架授权协议文件
|-logo.png     框架LOGO文件
|-README.txt   框架README文件
|-ThinkPHP.php 框架入口文件

d) Chapter Once you access Thinkphp in the browser, the common module Common, the default Home module, and the runtime directory will be automatically created in the Application. The following is the directory structure:

Application
|-Common      应用公共模块
| |-Common    应用公共函数目录
| |-Conf           应用公共配置文件目录
|-Home           默认生成的Home模块
| |-Conf           默块配置文件目录
| |-Common    模块函数公共目录
| |-Controller  模块控制器公共目录
| |-Model       模块模型目录
| |-View          模块视图文件目录
| |-Runtime    运行时文件目录
| |-Cache       模板缓存目录
| |-Data         数据目录
| |-Logs         日志目录
| |-Temp       缓存目录

e) After understanding the directory structure, let’s Understand why these directories are generated in Application?
ThinkPHP adopts a single entry mode for project deployment and access. No matter what function is completed, an application has a unified (but not necessarily the only) entry.

// 定义应用目录(Application可以改成其他的名称)
define('APP_PATH','./Application/');
// 引入ThinkPHP入口文件
require './ThinkPHP/ThinkPHP.php';

The above is the introduction and construction of the ThinkPHP framework (1) in [ThinkPHP Series]. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


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