当前位置:网站首页>What are the differences between TP5 and laravel
What are the differences between TP5 and laravel
2022-07-02 09:26:00 【Yisu cloud】
tp5 and laravel What are the differences
Let's share it with you tp5 and laravel What are the differences , I believe most people don't know much about , So share this article for your reference , I hope you will gain a lot after reading this article , Now let's go and have a look !
difference :1、Laravel When submitting the form, you need to add “@csrf” To prevent cross domain attacks , and tp No need to add ;2、Laravel Use “Db:: operation (‘ Native sql’)” Perform native queries , and tp Use “Db::query(‘ Native sql’)” Perform native queries .

The operating environment of this tutorial :windows10 System 、Laravel6 edition ,DELL G3 The computer .
tp5 and laravel What's the difference?
One .TP5 and Laravel The difference between frames
difference :
1、 How to submit data ,Laravel When submitting the form, you need to add @csrf perhaps {undefined{ csrf_token() }} To prevent cross domain attacks , and TP Can't .
2、 route ,Laravel Must be defined first , Reuse , The routing file is routes.php,TP After the route is enabled in the configuration file , The routing format is :‘ Routing expression ’ => ‘ Routing address and parameters ’( The premise of using routing is URL Support phthinfo And turn on routing ), Routing can make URL More in line with SEO.
3、 middleware ,Laravel Middleware , Middleware is HTTP The layer that the request passes through before arriving , Through the middleware, we can verify whether the user logs in and other general operations .
4、 How to operate the database , Can be instantiated ( Establish the corresponding model class ) and DB:table(‘ Table name ’) To manipulate the database , It's different when using native queries ,Laravel Use Db:: operation (‘ Native sql’),TP Use Db::query(‘ Native sql’);
5、Laravel Upgrading is easy , and TP To upgrade a large version, you need to refactor the code .
6. The difference in the writing method of conditional judgment sentences :
Laravel In frame if else Judge sentences and foreach sentence When writing, you must use @if start With @endif ending , If not, a syntax error will be reported ,@foreach @endforeach Empathy ;
and TP Frame and PHP Grammar rules are used in a consistent and direct way ifesle Sentence judgment and foreach Loop traversal
Two .CSRF Protect
CSRF Cross-site request forgery (Cross—Site Request Forgery), Follow XSS The attack is the same , There is great harm ,
defense CSRF attack :
Current defense CSRF There are three main strategies to attack : verification HTTP Referer Field ; Add... To the request address token And verify ; stay HTTP Custom properties in the header and verify .
Above is “tp5 and laravel What are the differences ” All the content of this article , Thank you for reading ! I believe we all have a certain understanding , I hope the content shared will be helpful to you , If you want to learn more , Welcome to the Yisu cloud industry information channel !
边栏推荐
- 数构(C语言--代码有注释)——第二章、线性表(更新版)
- Chrome browser plug-in fatkun installation and introduction
- 自定义Redis连接池
- 知识点很细(代码有注释)数构(C语言)——第三章、栈和队列
- I've taken it. MySQL table 500W rows, but someone doesn't partition it?
- Microservice practice | declarative service invocation openfeign practice
- Matplotlib剑客行——没有工具用代码也能画图的造型师
- JVM instruction mnemonic
- Data type case of machine learning -- using data to distinguish men and women based on Naive Bayesian method
- 【Go实战基础】gin 如何验证请求参数
猜你喜欢

Redis 序列化 GenericJackson2JsonRedisSerializer和Jackson2JsonRedisSerializer的区别

Matplotlib swordsman line - first acquaintance with Matplotlib

idea查看字节码配置

Machine learning practice: is Mermaid a love movie or an action movie? KNN announces the answer

Matplotlib剑客行——容纳百川的艺术家教程

Pool de connexion redis personnalisé

自定义Redis连接池

Troubleshooting and handling of an online problem caused by redis zadd

Cloudrev self built cloud disk practice, I said that no one can limit my capacity and speed

聊聊消息队列高性能的秘密——零拷贝技术
随机推荐
机器学习之数据类型案例——基于朴素贝叶斯法,用数据辩男女
Programmers with ten years of development experience tell you, what core competitiveness do you lack?
Mysql 多列IN操作
Timed thread pool implements request merging
微服务实战|手把手教你开发负载均衡组件
[staff] time sign and note duration (full note | half note | quarter note | eighth note | sixteenth note | thirty second note)
View the port of the application published by was
[go practical basis] how can gin get the request parameters of get and post
Matplotlib swordsman line - layout guide and multi map implementation (Updated)
Redis installation and deployment (windows/linux)
Attributes of classfile
win10使用docker拉取redis镜像报错read-only file system: unknown
Chrome browser tag management plug-in – onetab
[staff] common symbols of staff (Hualian clef | treble clef | bass clef | rest | bar line)
Chrome video download Plug-in – video downloader for Chrome
告别996,IDEA中必装插件有哪些?
Chrome user script manager tempermonkey monkey
Data type case of machine learning -- using data to distinguish men and women based on Naive Bayesian method
Don't look for it. All the necessary plug-ins for Chrome browser are here
[go practical basis] gin efficient artifact, how to bind parameters to structures