ThinkPHP开发系列一框架搭建
初期我们只要下载一也就是核心包。扩展包我们暂时用不到,后期再去下载。下载完成并解压的ThinkPHP文件夹放到我们所建的项目的根目录里面。我们知道我们的项目需要前台后后台。所以我们首先新建Home和Admin文件夹。
当我们实际部署网站的时候,目录结构往往由于项目的复杂而变得复杂。我们推荐的部署目录结构如下:
目录/文件 说明
ThinkPHP 系统目录(下面的目录结构同上面的系统目录)
Public 网站公共资源目录(存放网站的Css、Js和图片等资源)
Uploads 网站上传目录(用户上传的统一目录)
Home 项目目录(下面的目录结构同上面的应用目录)
Admin 后台管理项目目录
…… 更多的项目目录
index.php 项目Home的入口文件
admin.php 项目Admin的入口文件
…… 更多的项目入口文件
如果采用分组模块的话 可以简化为一个项目目录
目录/文件 说明
ThinkPHP 系统目录(下面的目录结构同上面的系统目录)
App 项目目录(分组目录结构会在后面描述)
Public 网站公共资源目录(存放网站的Css、Js和图片等资源)
Uploads 网站上传目录(用户上传的统一目录)
index.php 网站的入口文件
项目的模板文件还是放到项目的Tpl目录下面,只是将外部调用的资源文件, 包括图片 JS 和CSS统一放到网站的公共目录Public下面,分Images、Js和Css子目录存放,如果有可能的话,甚至也可以把这些资源文件单独放一个外部的服务器远程调用,并进行优化。
这里我们选择第二种目录方式。ThinkPHP需要一个入口文件,也就是项目根目录下面的index.php。内容是: //定义项目名称
//定义项目名称
define('APP_NAME', 'app');
//定义项目路径
define('APP_PATH', './app/');
/* 数据目录*/
define('Egojit_DATA_PATH', './data/');
/* 配置文件目录*/
define('CONF_PATH', Egojit_DATA_PATH . 'config/');
//加载框架入文件
require './ThinkPHP/ThinkPHP.php';
为什么选择这种分组目录,主要是因为个人觉得这种分组目录更加的简单明了。这样我们请求这个网站,你会发现在app目录下面会自动生成很多目录。如果成功你会见到如图所示画面

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The Xiaomi Mi 15 series is expected to be officially released in October, and its full series codenames have been exposed in the foreign media MiCode code base. Among them, the flagship Xiaomi Mi 15 Ultra is codenamed "Xuanyuan" (meaning "Xuanyuan"). This name comes from the Yellow Emperor in Chinese mythology, which symbolizes nobility. Xiaomi 15 is codenamed "Dada", while Xiaomi 15Pro is named "Haotian" (meaning "Haotian"). The internal code name of Xiaomi Mi 15S Pro is "dijun", which alludes to Emperor Jun, the creator god of "The Classic of Mountains and Seas". Xiaomi 15Ultra series covers

Since the Huawei Mate60 series went on sale last year, I personally have been using the Mate60Pro as my main phone. In nearly a year, Huawei Mate60Pro has undergone multiple OTA upgrades, and the overall experience has been significantly improved, giving people a feeling of being constantly new. For example, recently, the Huawei Mate60 series has once again received a major upgrade in imaging capabilities. The first is the new AI elimination function, which can intelligently eliminate passers-by and debris and automatically fill in the blank areas; secondly, the color accuracy and telephoto clarity of the main camera have been significantly upgraded. Considering that it is the back-to-school season, Huawei Mate60 series has also launched an autumn promotion: you can enjoy a discount of up to 800 yuan when purchasing the phone, and the starting price is as low as 4,999 yuan. Commonly used and often new products with great value

Evaluating the cost/performance of commercial support for a Java framework involves the following steps: Determine the required level of assurance and service level agreement (SLA) guarantees. The experience and expertise of the research support team. Consider additional services such as upgrades, troubleshooting, and performance optimization. Weigh business support costs against risk mitigation and increased efficiency.

The learning curve of a PHP framework depends on language proficiency, framework complexity, documentation quality, and community support. The learning curve of PHP frameworks is higher when compared to Python frameworks and lower when compared to Ruby frameworks. Compared to Java frameworks, PHP frameworks have a moderate learning curve but a shorter time to get started.

The lightweight PHP framework improves application performance through small size and low resource consumption. Its features include: small size, fast startup, low memory usage, improved response speed and throughput, and reduced resource consumption. Practical case: SlimFramework creates REST API, only 500KB, high responsiveness and high throughput

Using the ThinkPHP6 framework combined with elasticsearch-php client to operate Elasticsearch...

ThinkPHP6 routing parameters are processed in Chinese and complete acquisition. In the ThinkPHP6 framework, URL parameters containing special characters (such as Chinese and punctuation marks) are often processed...

Choose the best Go framework based on application scenarios: consider application type, language features, performance requirements, and ecosystem. Common Go frameworks: Gin (Web application), Echo (Web service), Fiber (high throughput), gorm (ORM), fasthttp (speed). Practical case: building REST API (Fiber) and interacting with the database (gorm). Choose a framework: choose fasthttp for key performance, Gin/Echo for flexible web applications, and gorm for database interaction.
