Home > Hosting > System

What is the difference between tp5 and laravel framework?

2024-01-28 05:58:20

1, TP framework:

ThinkPhp is simple, fast, MVC-based and object-oriented, and easy to use. It is a simple and practical lightweight framework.

2. Laravel framework:

Lavavel has been adhering to the principle of elegance, supporting composer well, realizing richer expansion and active community documents. Compared with TP, Lavavel is larger and safer, and is more suitable for developing large and medium-sized projects, so it is called a master development framework.

3. Difference

1) The way to submit data, Laravel needs to add {csrf_field} in the form to prevent cross-domain * * *, while TP does not.

2) Routing, Laravel must be defined before use. The routing file is routes.php. After TP opens the routing in the configuration file, the routing format is:' routing expression' = >' routing address and parameters' (the premise of using routing is that the URL supports phthinfo and the routing is turned on). Routing can make the URL more in line with SEO.

3) Middleware, Laravel's middleware. Middleware is the layer that HTTP requests go through before they arrive. Through middleware, we can verify whether users log in or not and other general operations.

4) The way to operate the database is to use instantiation (establishing corresponding model classes) and DB:table ('table name') to operate the database, which is different when using native query. Laravel uses Db:: operation ('native sql') and TP uses Db::query ('native SQL');

5)Laravel upgrade is very simple, while the upgrade of TP version needs to reconstruct the code.

Related tutorial recommendation:

Laravel video tutorial

ThinkPHP framework


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us