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's the difference between thinkphp5 and laravel?

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "what's the difference between thinkphp5 and laravel". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what's the difference between thinkphp5 and laravel"?

The operating environment of this tutorial: windows7 system, Laravel6&&thinkphp5 version, DELL G3 computer.

What are the differences between Laravel framework and thinkphp5 framework

The first is the way they render the template:

The Thinkphp statement is: $this- > display ()

The Laravel statement is: return view ()

The second is that they have different ways of crossing stations:

Thinkphp needs to manually complete the code to prevent cross-site attacks.

Laravel takes into account cross-transfer request forgery, using the form form to pass the value in post, and to add {{csrf_field ()}} to the form form to do so, without {{csrf_field}} displaying token token error

The third point is that routing is different:

Thinkphp (3. 2) must fill in the controller, otherwise it cannot be accessed

Lavarel is a rerouting framework, and all functions are initiated by routing. It can have no controller method, no model, no view, but there must be routing.

The fourth point is middleware:

Thinkphp: no middleware

Laravel: with middleware, you can process before and after access (request and return, authority authentication, etc.)

The fifth point is that the encryption methods are different:

Thinkphp: it uses the md5 () encryption algorithm in the thinkphp built-in algorithm, which is easy to be cracked by the outside world and forced to crack.

Laravel: uses the built-in hash encryption (one-way encryption), there is no reverse cracking.

Laravel has a large number of built-in methods for developers to use, which is closer to the development idea of "let objects do everything" in practical applications. For example, when verifying forms in the background, Laravel has a large number of built-in verification methods, such as user name verification: we can use 'username'= >' required' (cannot be empty) in the validate method. Alpha_dash (must be underlined with numbers), etc.

The sixth point is the difference between If and foreach statements:

Thinkphp: consistent with native php

Laravel: be sure to add the @ symbol (@ if-@endif @ foreach-@endforeach) when writing.

Thank you for your reading, the above is the content of "what's the difference between thinkphp5 and laravel". After the study of this article, I believe you have a deeper understanding of the difference between thinkphp5 and laravel, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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