Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between thinkphp5.0 and 5.1

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "what are the differences between thinkphp5.0 and 5.1". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what's the difference between thinkphp5.0 and 5.1"?

Difference: 1, the initialization method "_ initialize" is changed to "initialize" in thinkphp5.1; 2, there is no "conf.php" file in thinkphp5.1, all configuration files are split, and the file exists in thinkphp5.0.

This article operating environment: Windows10 system, ThinkPHP5 version, Dell G3 computer.

What's the difference between thinkphp5.0 and 5.1?

ThinkPHP5.1 has made further improvements to the underlying architecture on the basis of 5.0, introducing new features and upgrading version requirements. Another fact is that version 5.1 looks more developer-friendly, with a more intuitive directory structure, more intuitive debug output, and more intuitive code hints.

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 is to remove an underscore.

two。 Htmlentities security filtering is added by default to the variable output of the template

For example, the previously customized page is {$page}. In version 5.1, it needs to be changed to {$page | raw}, and any html output is added with | raw.

For time conversion, you need to remove the previous # in date, otherwise the page will generate an error. Please note.

There is no conf.php file in 3.TP5.1. All configuration files are split.

This is the application directory structure. The default profile is app.php

The module directory is also best set under the application directory.

4. Tp5.1 will not take the initiative to empty the database, while tp5.0 will automatically empty the data of the last query. Add:

/ / clear query criteria (excluding sorting or fields and other information) $user- > removeOption ('where')

5. The model, like Db, does not need to be instantiated manually and is easy to use.

At this point, I believe you have a deeper understanding of "what is the difference between thinkphp5.0 and 5.1". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report