Home >PHP Framework >Laravel >What is the difference between tp5 and laravel framework

What is the difference between tp5 and laravel framework

步履不停
步履不停Original
2019-06-29 14:48:295618browse

What is the difference between tp5 and laravel framework

1. TP framework:

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

2. Laravel framework:

Lavavel has always adhered to the principle of elegance, supported composer well, implemented richer extensions, and had active community documentation. Compared with TP, Lavavel is more It is huge, has higher security, and is more suitable for developing large and medium-sized projects. It is called the "master development framework".

3. Difference

1) The way to submit data, Laravel needs to add {csrf_field} to the form when submitting the form to prevent cross-domain attacks, but TP does not.

2) Routing, Laravel must be defined first before using it. The routing file is routes.php. After TP turns on routing in the configuration file, the routing format is: 'Routing expression' => 'Routing address and Parameters' (the prerequisite for using routing is that the URL supports phthinfo and routing is enabled), routing can make the URL more in line with SEO.

3) Middleware, Laravel's middleware, middleware is the layer that HTTP requests pass through before reaching it. Through middleware, we can verify whether the user is logged in and other common operations.

4) To operate the database, you can use instantiation (create the corresponding model class) and DB:table ('table name') to operate the database. It is not the same when using native queries. Laravel uses Db ::Operation('native sql'), TP uses Db::query('native sql');

5) Laravel upgrade is very simple, while upgrading large versions of TP requires refactoring the code.


Related tutorial recommendations:

Laravel video tutorial

##ThinkPHP Framework

The above is the detailed content of What is the difference between tp5 and laravel framework. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn