当前位置:网站首页>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 !
边栏推荐
- 企业级SaaS CRM实现
- Redis zadd导致的一次线上问题排查和处理
- Complete solution of servlet: inheritance relationship, life cycle, container, request forwarding and redirection, etc
- 知识点很细(代码有注释)数构(C语言)——第三章、栈和队列
- 微服务实战|手把手教你开发负载均衡组件
- [staff] common symbols of staff (Hualian clef | treble clef | bass clef | rest | bar line)
- AMQ 4043 solution for errors when using IBM MQ remote connection
- Don't spend money, spend an hour to build your own blog website
- Double non undergraduate students enter the factory, while I am still quietly climbing trees at the bottom (Part 1)
- 京东面试官问:LEFT JOIN关联表中用ON还是WHERE跟条件有什么区别
猜你喜欢
自定义Redis连接池
[staff] common symbols of staff (Hualian clef | treble clef | bass clef | rest | bar line)
微服务实战|熔断器Hystrix初体验
Say goodbye to 996. What are the necessary plug-ins in idea?
[go practical basis] how to customize and use a middleware in gin
MySQL multi column in operation
京东面试官问:LEFT JOIN关联表中用ON还是WHERE跟条件有什么区别
远程连接IBM MQ报错AMQ4036解决方法
盘点典型错误之TypeError: X() got multiple values for argument ‘Y‘
「Redis源码系列」关于源码阅读的学习与思考
随机推荐
C4D quick start tutorial - Chamfer
Flink-使用流批一体API统计单词数量
【Go实战基础】如何安装和使用 gin
Machine learning practice: is Mermaid a love movie or an action movie? KNN announces the answer
WSL安装、美化、网络代理和远程开发
Chrome user script manager tempermonkey monkey
【Go实战基础】gin 如何获取 GET 和 POST 的请求参数
Solution to amq4036 error in remote connection to IBM MQ
Knife4j 2.X版本文件上传无选择文件控件问题解决
分布式锁的这三种实现方式,如何在效率和正确性之间选择?
C language implementation of mine sweeping game
View the port of the application published by was
Redis 序列化 GenericJackson2JsonRedisSerializer和Jackson2JsonRedisSerializer的区别
Win10 uses docker to pull the redis image and reports an error read only file system: unknown
Redis安装部署(Windows/Linux)
西瓜书--第五章.神经网络
Solutions to Chinese garbled code in CMD window
机器学习之数据类型案例——基于朴素贝叶斯法,用数据辩男女
cmd窗口中中文呈现乱码解决方法
Microservice practice | Eureka registration center and cluster construction