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

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

问题描述

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

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

谢谢.

推荐答案

要在它们之间进行选择,我使用以下简单规则:

To choose between them I use this simple rule:

获取读取.(读取数据并显示)

GET for reads. (reading data and displaying it)

POST 用于写入的任何内容(即更新数据库表、删除条目等)

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

另一个考虑是 GET 受制于最大 URI 长度,当然不能处理文件上传.

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

这个页面有一个很好的总结.

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

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