网站建设财务策划书,平台推广计划,做设计在哪个网站投递简历,哪里有做网站的前些天发现了一个巨牛的人工智能学习网站#xff0c;通俗易懂#xff0c;风趣幽默#xff0c;忍不住分享一下给大家。点击跳转到教程。
一、
GET和POST两种方法都是将数据送到服务器#xff0c;但你该用哪一种呢#xff1f; HTTP标准包含这两种方法是为了达到不同的目的…前些天发现了一个巨牛的人工智能学习网站通俗易懂风趣幽默忍不住分享一下给大家。点击跳转到教程。
一、
GET和POST两种方法都是将数据送到服务器但你该用哪一种呢 HTTP标准包含这两种方法是为了达到不同的目的。POST用于创建资源资源的内容会被编入HTTP请示的内容中。例如处理订货表单、在数据库中加入新数据行等。 当请求无副作用时如进行搜索便可使用GET方法当请求有副作用时如添加数据行则用POST方法。一个比较实际的问题是GET方法可能会产生很长的URL或许会超过某些浏览器与服务器对URL长度的限制。 若符合下列任一情况则用POST方法 * 请求的结果有持续性的副作用例如数据库内添加新的数据行。 * 若使用GET方法则表单上收集的数据可能让URL过长。 * 要传送的数据不是采用7位的ASCII编码。 若符合下列任一情况则用GET方法 * 请求是为了查找资源HTML表单数据仅用来帮助搜索。 * 请求结果无持续性的副作用。 * 收集的数据及HTML表单内的输入字段名称的总长不超过1024个字符。 二、
最近开到一段W3的资料写的不错原文地址如下http://bu-choreography.iteye.com/admin/blogs/new。翻译总结如下 快速判断 如下情况使用GET方法客户端与服务端的交互像是一个提问(如查询操作、搜索操作、读操作) 如下情况使用POST方法 1.交互是一个命令或订单(order)比提问包含更多信息 2.交互改变了服务器端的资源并被用户察觉例如订阅某项服务 3.用户需要对交互产生的结果负责 听起来稍微明白了一点接着来。 根据HTTP协议规定GET方法可以携带交互需要的所有数据因此你会看到搜索百度或谷歌的时候点击搜索形成的URL包含了你刚才的搜索关键字没有安全需求的请求把信息放URL里没关系但是你访问银行网站的时候不希望把账户、密码这些放在URL里被人拦截是吧所以HTTP设计了POST请求他可以把请求信息放在HTTP请求里具体格式这里不细说了这样你就不能简单的从URL里找到账户、密码了。 讲完这些是不是比较清楚了呢。 文章还例举了几个曾经的HTTP请求限制。 1.URI不能超过256个字符。这个限制在有些服务器里是存在的有的服务器为了网络安全为了防止拒绝式攻击会把URL字符限制在4000字符 2.你提交了GET请求又马山按了backspace键会导致get方法被重新执行 3.你在一个页面使用了安全协议跳转到了另一个使用不安全协议的页面时会导致安全数据泄漏给第二个页面。 以上一中内容摘自《Web Database Application with PHP and MySQL, 2nd Edition》一书中文版《PHP MySQL Web数据库应用开发指南》。英文原文内容如下 GET versus POST Both the GET and POST methods send data to the server, but which method should you use? The HTTP standard includes the two methods to achieve different goals. The POST method was intended to create a resource. The contents of the resource would be encoded into the body of the HTTP request. For example, an order form might be processed and a new row in a database created. The GET method is used when a request has no side effects (such as performing a search) and the POST method is used when a request has side effects (such as adding a new row to a database). A more practical issue is that the GET method may result in long URLs, and may even exceed some browser and server limits on URL length. Use the POST method if any of the following are true: * The result of the request has persistent side effects such as adding a new database row. * The data collected on the form is likely to result in a long URL if you used the GET method. * The data to be sent is in any encoding other than seven-bit ASCII. Use the GET method if all the following are true: * The request is to find a resource, and HTML form data is used to help that search. * The result of the request has no persistent side effects. * The data collected and the input field names in a HTML form are in total less than 1,024 characters in size.