MVC模式中Ajax中GET/POST/PUT/DELETE的区别
据我所知,GET 通常与 URL 相关联,您可以将其放入浏览器中并再次完成确切的操作,例如查看特定人员的个人资料。
我正在使用 CI 实现 MVC 模式,并使用类型为:GET 的 $.ajax 到以下 URL:
url : 'index.php/con/fx1',
其中 con 是控制器, fx 1 是控制器中的一个函数。
我可以将 fx1 定向到任何模型并执行任何操作,无论是发布、删除还是只是读取。
从这个意义上说,我是否指定 GET/POST/DELETE/PUT 有什么区别
I understand that GET is typically associated with a URL where you can put in the browser and get the exact action done again, like viewing a profile for a particular person.
I am implementing MVC pattern with CI, and with a $.ajax of type:GET to the following URL:
url : 'index.php/con/fx1',
where con is the controller,
fx 1 is a function in the controller.
I can direct fx1 to any model and do anything, be it POST, DELETE, or just READ.
In this sense, what difference does it make whether I specify GET/POST/DELETE/PUT
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我是一名 Ruby on Rails 开发人员。但MVC模式对于所有人来说都是通用的(包括php框架)。我以我的方式描述。
了解更多:http://en.wikipedia.org/wiki/Representational_State_Transfer
I'm a ruby on rails developer. But the MVC pattern is common for all (including php framework). I'm described in my way.
for more: http://en.wikipedia.org/wiki/Representational_State_Transfer
区别在于描述意图。当然,我可以使用 GET 或 POST 提交表单。不同之处在于,在 REST 中,GET 意味着一件事,POST 意味着另一件事。
即使没有区分请求类型的技术原因,也可能存在概念原因。
The difference is in describing intent. I could, of course, submit a form using either GET or POST. The difference is that in REST a GET means one thing, a POST means another.
Even when there aren't technical reason for differentiating request types, there may be conceptual reasons for doing so.
GET
和POST
的用途截然不同。PUT
和DELETE
也是如此。与其重复很多很多其他人已经就这个主题说过的话,谷歌GET和POST之间的区别
。GET
andPOST
serve very different purposes. As doPUT
andDELETE
. Rather than repeat what many, many others have already said on this topic, Googledifference between GET and POST
.