Home >PHP Framework >ThinkPHP >What is the difference between 5 and 6 in thinkphp
Differences: 1. thinkphp5 defaults to multiple applications, while thinkphp6 defaults to single application; 2. thinkphp5 loads the official template engine by default, but thinkphp6 does not load the official template engine by default; 3. thinkphp5 enables session by default, but thinkphp6 does not by default Enable.
The operating environment of this article: Windows 10 system, ThinkPHP version 5, Dell G3 computer.
1. Thinkphp5 defaults to multi-application, Thinkphp6 defaults to single application
You need to enable multi-application mode and need to install it separately
Execute the command composer require topthink/think-multi-app
2. Thinkphp5 loads the official template engine by default, Thinkphp6 does not load the official template engine by default
Requires use and needs to be installed separately
Execute the command composer require topthink/think-view
3.Thinkphp5 enables session by default, Thinkphp6 does not enable session by default
Use verification code, the verifier needs to enable session
Loading templates, assigning values to templates, and receiving parameters
thinkphp5 can inherit think\Controller
$this->request->param() to receive parameters,
$this->assign() template variable assignment
$this->fetch() load attempt
thinkphp6 no longer has the think\Controller class, you can use it directly The facade class of the corresponding class.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What is the difference between 5 and 6 in thinkphp. For more information, please follow other related articles on the PHP Chinese website!