什么是Restful路由? [英] What is Restful Routing?

查看:24
本文介绍了什么是Restful路由?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我熟悉 Ruby On Rails 的路由系统以及 Code Igniter 和 PhpCake 如何路由事物,但除了拥有一个可以根据目录结构给出路由的集中位置之外,还有更多其他用途吗?像这样

I'm familiar with Ruby On Rails's routing system and well as how Code Igniter and PhpCake route things but is there more to it than having a centralized location where you give out routes based on a directory structure? Like this

controller/action/id/
Admin/editUser/22

推荐答案

基本前提是,与其完全依赖 URL 来指示您要访问的网页(并且只使用一种方法),而是一种组合动词和 URL.

The basic premise is, instead of relying exclusively on the URL to indicate what webpage you want to go to (and just using the one method), it's a combination of VERB and URL.

这样,当同一个 URL 与不同的动词(如 GET、PUT、POST、DELETE)一起使用时,您将进入不同的页面.这使得 URL 更简洁、更短,并且特别适用于大多数网络应用程序的 CRUD 应用程序.

This way, the same URL, when used with a different verb (such as GET, PUT, POST, DELETE), will get you to a different page. This makes for cleaner, shorter URLs, and is particularly adapted to CRUD applications, which most web apps are.

这篇关于什么是Restful路由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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