Home > Article > PHP Framework > What is the difference between thinkphp3 and 5?
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.
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!