表单method方法 post 与get的区别

URL地址栏:
Post传输数据时,不需要在URL中显示出来,而Get方法要在URL中显示。


传输原理:
rfc2616
9.3 GET
The GET method means retrieve whatever information (in the form of an
entity) is identified by the Request-URI. If the Request-URI refers
to a data-producing process, it is the produced data which shall be
returned as the entity in the response and not the source text of the
process, unless that text happens to be the output of the process...
9.5 POST
The POST method is used to request that the origin server accept the
entity enclosed in the request as a new subordinate of the resource
identified by the Request-URI in the Request-Line...

POST 方法被用于请求源服务器接受请求中的实体作为请求资源的一个新的从属物,而Get是以实体的格式获取被请求URI(Request-URI)指定的信息,并且根据rfc2616 get方法是可缓存的,也就是说如果get请求信息满足于http缓存规律的话,这部分信息可以直接从缓存中获取,由此决定了get方法要比post速度快。

数据量:
Post传输的数据量大,可以达到2M,而Get方法由于受到URL长度的限制,只能传递大约1024字节(具体与浏览器和web服务器支持相关,可参见 2009-10-29转帖 URL最大长度限制).


传输字符集:
Get限制Form表单的数据集的值必须为ASCII字符;而Post支持整个ISO10646字符集,默认使用ISO-8859-1编码

安全性:
Get所有传递的参数对于用户是可见的,不安全,Post的所有操作对用户来说都是不可见。

默认:
表单提交时,如果不人为规定,那么默认传递方式是 method='GET'

参考:
1、http://cache.baidu.com/c?m=9f65cb4a8c8507ed4fece763104c8c711923d030678197027fa3c215cc79051c0331a3e770640d548d98297a5ae91e03f7fa3472615722e6cac2de4c8beb932f7f8a7064711a811013c419d891007a9f34d507a9f916a5e7b17484aea386881244ca22120c85e7fd5e1764cf78846426e2d68e38644863ce&p=c677c64ad3d814ff57ea91284d0a&user=baidu
2、http://tj9900.iteye.com/blog/487656
3、 RFC2616-Hypertext Transfer Protocol __ HTTP/1.1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值