The difference between thinkphp3 and 5: 1. URL access in thinkphp3 supports normal url mode, but thinkphp5 does not support it; 2. Thinkphp5 adds routing variable rules, resource routing and routing grouping, etc., but thinkphp3 does not .
The operating environment of this article: Windows 10 system, ThinkPHP version 5, Dell G3 computer.
What is the difference between thinkphp3 and 5
Entry file location
5 public index.php file under the root directory
Routing control
5.0 url access no longer supports normal url mode (get method)
Improvement:
Add routing variable rules;
Add combination variable support;
Add resource routing;
Add routing grouping
Add must-report definition support
Support MISS routing definition
Request and response:
New request object Request and corresponding object Response
Controller aspect
The controller class name does not have the Controller suffix by default
Newly created controller classes do not need to integrate any controller classes
Control output
It is no longer a direct output, but a return array Or json object
3.2 $this->display()
5.0 return $this->fetch()
Template engine
The module delimiter is changed from the original -> {}
Newly added: Template inheritance function named block {block name}
Assistant function
3.2 M D
5.0 model db
G() -> debug()
E() -> exception()
C() -> config()
I() -> input()
W() -> widget()
D() -> model()
S() -> cache()
U() -> url()
The bottom layer of the database Some methods
Newly added:
Support closure query
Support block query
Support view query
Add SQL listening event
5.0 value() column()
Model Add the following
The suffix of the model class no longer contains Model
Main improvements include:
Reconstruct the association model;
Support the aggregation model;
Abolish the view model (change to the view query method of the database);
The extension of the model adopts the Trait mechanism;
Add getters and modifiers;
Add automatic writing of timestamps;
Add type field conversion;
Array access support;
JSON serialization support;
Automatic verification and automatic completion
The underlying database driver supports mysql Sqlite PgSQL, Oracle, PDO
Simplification of constants
The 5.0 version has abandoned most of the original constant definitions and only retains the framework's road constant definitions. The remaining constants can be obtained using the APP class to obtain the Request related attribute acquisition method. Complete
recommended learning: "PHP Video Tutorial"
The above is the detailed content of What is the difference between thinkphp3 and 5?. For more information, please follow other related articles on the PHP Chinese website!

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

Atom editor mac version download
The most popular open source editor

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.