我应该如何在HTML表单中选择GET和POST方法? [英] How should I choose between GET and POST methods in HTML forms?

查看:82
本文介绍了我应该如何在HTML表单中选择GET和POST方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道使用这两种方法的所有优点和缺点。特别是对网络安全的影响。

谢谢。

解决方案

要选择它们,我使用这个简单的规则:



GET读取。 (阅读数据并显示它)

POST对于任何写入的东西(例如更新数据库表,删除条目等)

另一个考虑因素是GET受到最大URI长度的限制,当然不能处理文件上传。



此页面有一个好的总结


I wish to know all the pros and cons about using these two methods. In particular the implications on web security.

Thanks.

解决方案

To choose between them I use this simple rule:

GET for reads. (reading data and displaying it)

POST for anything that writes (i.e updating a database table, deleting an entry, etc.)

The other consideration is that GET is subjected to the maximum URI length and of course can't handle file uploads.

This page has a good summary.

这篇关于我应该如何在HTML表单中选择GET和POST方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆