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 are the differences between thinkphp3 and thinkphp5

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

Share

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

This article mainly introduces the differences between thinkphp3 and thinkphp5 related knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe you will gain after reading this thinkphp3 and thinkphp5 article, let's take a look at it.

The difference between thinkphp3 and 5: 1. Normal url mode is supported for url access in thinkphp3, but not in thinkphp5. 2. Routing variable rules, resource routing and routing packets are added in thinkphp5, but not in thinkphp3.

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

What's the difference between thinkphp3 and 5?

Entry file location

5 index.php file under the root directory of public

Route control

5.0 url access no longer supports normal url mode (get method)

Improvements:

Add routing variable rules

Added support for combined variables

Increase resource routing

Add routing packets

Add support for required definition

Support for MISS routing definition

Request and response:

Add request object Request and corresponding object Response

Controller aspect

Controller class name defaults without Controller suffix

Newly created controller classes do not need to integrate any controller classes

Control output

It is no longer a direct output, but an return array or json object

3.2$ this- > display ()

5.0 return $this- > fetch ()

Template engine

The module delimiter is defined by the original-> {}

New: template inherits 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 ()

Some methods at the bottom of the database

Newly added:

Support for closure query

Block query is supported

Support for view query

Add SQL snooping events

5.0 value () column ()

Model is added as follows

Model classes are no longer suffixed with Model

Major improvements include:

Reconstruct the correlation model

Support for aggregation model

Abolish the view model (change to the view query method of database)

The extension of the model adopts Trait mechanism.

Add catchers and modifiers

Add a timestamp to write automatically

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

Constant simplification

Version 5.0 discards most of the original constant definitions and only retains the framework's road strength constant definition. The rest of the constants can be accomplished by using the APP class to obtain Request-related properties.

This is the end of the article on "what are the differences between thinkphp3 and thinkphp5". Thank you for reading! I believe you all have a certain understanding of the knowledge of "what is the difference between thinkphp3 and thinkphp5". If you want to learn more, you are welcome to follow the industry information channel.

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