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.
What is the difference between thinkphp5.0 and 5.1
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!

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

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

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