Home > Article > PHP Framework > What is the difference between thinkphp5.0 and 5.1
Differences: 1. Change the initialization method "_initialize" to "initialize" in thinkphp5.1; 2. There is no "conf.php" file in thinkphp5.1, and all configuration files are split Open, and this file exists in thinkphp5.0.
The operating environment of this article: Windows 10 system, ThinkPHP version 5, Dell G3 computer.
ThinkPHP5.1 has further improved the underlying architecture on the basis of 5.0, introduced new features, and improved version requirements. Another fact is that version 5.1 seems to be more developer-friendly, reflected in a more intuitive directory structure, more intuitive debugging output, and more intuitive code prompts.
1. Controller initialization method _initialize
Generally this is written in Common to allow subclasses to inherit. In tp5.1, you need to change _initialize to initialize, which means removing one Underline.
2. The variable output of the template has htmlentities security filtering added by default
If the previously customized paging was {$page}, it needs to be changed to {$page|raw} in version 5.1, any The html output is added with |raw.
To convert time to date, you need to remove the previous
, otherwise the page will generate an error. Please note that3.TP5.1 does not have a conf.php file, and all configuration files have been dismantled. SeparatelyThis is the application directory structure. The default configuration file is app.phpThe module directory is best set under the application directory. 4. tp5.1 will not take the initiative to clear the database, but tp5.0 will automatically clear the last query data. You must add:// 清除查询条件(但不包括排序或者字段等信息) $user->removeOption('where');5. The model does not require manual operation like Db. To instantiate, it is very convenient to use. 6. Environment variables:
Recommended learning: "PHP Video Tutorial
"
The above is the detailed content of What is the difference between thinkphp5.0 and 5.1. For more information, please follow other related articles on the PHP Chinese website!