为什么 GET 方法比 HTTP 中的 POST 更快? [英] Why is the GET method faster than POST in HTTP?

查看:31
本文介绍了为什么 GET 方法比 HTTP 中的 POST 更快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是网络编程的新手,只是想知道将数据从一个页面发送到另一个页面的 GET 和 POST 方法.

I am new to web programming and just curious to know about the GET and POST methods of sending data from one page to another.

据说 GET 方法比 POST 更快,但我不知道为什么.我能找到的一个原因是 GET 只能取 255 个字符?还有其他原因吗?请有人给我解释一下.

It is said that the GET method is faster than POST but I don't know why. One reason I could find is that GET can take only 255 characters? Is there any other reason? Please someone explain to me.

推荐答案

与速度无关.有很多情况下 POST 更适用.例如,搜索引擎会将 GET URL 编入索引,浏览器可以为它们添加书签并使它们出现在历史记录中.因此,如果您采取诸如根据 GET 请求修改数据库之类的操作,这可能是有害的,因为某些机器人也可能会遍历 URL.

It's not much about speed. There are plenty of cases where POST is more applicable. For example, search engines will index GET URLs and browsers can bookmark them and make them show up in history. As a result, if you take actions like modifying a DB based on a GET request, it might be harmful as some bots might also traverse the URL.

另一种情况可能是安全问题.如果您使用 GET 发布凭据,它将在浏览器历史记录和服务器日志文件中列出.

The other case can be security issue. If you post credentials using GET, it'll get listed in browser history and server log files.

这篇关于为什么 GET 方法比 HTTP 中的 POST 更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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