php - api路径怎么命名比较好?
我想大声告诉你
我想大声告诉你 2017-05-16 13:07:20
0
1
532

api给app、spa或者后台某些需要ajxa的功能使用的

看到有的人使用index?c=reg&xxx=xxx
有的使用
/user/getList
/user/get_list
/user/get-list
/user.getList
还有一种是/userGetList 这种推荐吗?

然后剩下的是REST方式
/user/1 get post put path
/user

但是我发现国外那些什么网盘 twiiter github用rest多,国内基本很少,而且好像也不适合?

我想大声告诉你
我想大声告诉你

reply all (1)
習慣沉默

RESTful is just a specification, not a standard that forces you to use it. Following it can make your API interface more standardized and professional. Of course, you can also choose not to use it. Just implement it according to the specifications agreed by your own project team.
RESTful mode:
http(s)://server.com/app-name/{version}/{domain}/{rest-convention}
Here, {version} represents the version information of the api. {domain} is an area that you can use to define any technical (for example: security - allow specified users to access this area.) or business reasons. (For example: the same functions are under the same prefix.)
{rest-convention} represents the agreed set of REST interfaces in this domain.

There are a lot of RESTful guarantee specifications available online, so I’ll just post the address here for your reference.
http://www.coderli.com/transl...

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!