The difference between laravel framework and thinkPHP framework
The difference between the laravel framework and thinkPHP framework
Main differences:
1. The difference in rendering template methods:
In the Laravel framework, Use return view() to render the template;
And ThinkPHP uses $this->display() to render the template;
2. In the Laravel framework, due to its considerations It’s cross-site request forgery, so if you use the form form to pass values in the post method, if you don’t add {{csrf_field()}} to the form form, a syntax error of TokenMethodnotfound will be reported;
And TP The framework needs to manually complete the code to prevent cross-site attacks;
3. Laravel is a rerouting framework (5.4). All functions are initiated by routing. Even if there is no controller method, just write You can access it by routing, thinkPHP (3.2), you must have a controller method for normal access;
4. Laravel has powerful community extensions (composer extension is automatically loaded);
5. Laravel has a powerful Blade template engine;
6. Middleware, Laravel features, can realize processing before and after access, such as request and return, permission authentication, etc.;
7. Conditional judgment Differences in the way statements are written:
The if else judgment statement and the foreach statement in the Laravel framework must start with @if and end with @endif. If not, a syntax error will be reported. The same is true for @foreach@endforeach; and TP The framework is used in the same way as PHP syntax rules, direct ifesle statement judgment and foreach loop traversal
8. Laravel has a large number of built-in methods for developers to use, which in actual applications is closer to "let the object do everything" Development ideas, for example, during background form verification, Laravel has a large number of built-in verification methods, such as verification of username: we use 'username'=>'required' (cannot be empty)|alpha_dash( in the validate method Must have numbers, letters and underlines) | between: 6, 18 (between the number of digits); It also has built-in a large number of methods such as email; same: field name; diff: field name, etc., which greatly improves the development speed;
9. Encryption method In the TP framework, we use md5(); to encrypt usernames and passwords. However, the disadvantage of md5 is that it can be reversely cracked, and the same password md5 is encrypted under the same rules. The strings may appear the same, which reduces its security; however, the "hash" Hash encryption one-way encryption method is built into the Laravel framework, and the strings encrypted with the same parameters will never appear the same. This improves security;
10. In actual development, we often encounter such a problem, that is, the development location is not fixed, which causes us to frequently change the database configuration, which greatly affects the development work. Caused trouble, TP still did not avoid this "disaster"; in the laravel framework, the emergence of .env environment files solved this trouble. We only need to configure the .env files in different work locations and do not need to configure them again, because no matter Is it git or svn ".env will not be submitted to the server along with the file";
Related recommendations:《TP5》《laravel》
The above is the detailed content of The difference between laravel framework and thinkPHP framework. 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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Method for obtaining the return code when Laravel email sending fails. When using Laravel to develop applications, you often encounter situations where you need to send verification codes. And in reality...

Laravel schedule task run unresponsive troubleshooting When using Laravel's schedule task scheduling, many developers will encounter this problem: schedule:run...

The method of handling Laravel's email failure to send verification code is to use Laravel...

How to implement the table function of custom click to add data in dcatadmin (laravel-admin) When using dcat...

Laravel - Dump Server - Laravel dump server comes with the version of Laravel 5.7. The previous versions do not include any dump server. Dump server will be a development dependency in laravel/laravel composer file.

The impact of sharing of Redis connections in Laravel framework and select methods When using Laravel framework and Redis, developers may encounter a problem: through configuration...

Custom tenant database connection in Laravel multi-tenant extension package stancl/tenancy When building multi-tenant applications using Laravel multi-tenant extension package stancl/tenancy,...

Laravel - Action URL - Laravel 5.7 introduces a new feature called “callable action URL”. This feature is similar to the one in Laravel 5.6 which accepts string in action method. The main purpose of the new syntax introduced Laravel 5.7 is to directl
