1. REST is a basic thought and theory. 如果我們把rest用于我們的api接口設計里,這樣就產生了restful style 的api.
restful api 是rest在web接口中的一種apply and extension,
2. REST is no status.
For example:u sent 2 http requests, then 這兩個http沒有順序關系,兩者之間不搭嘎,
3. What is has status?
Open db ,operate db ,then close ,this is called stauts ga a ru.
4. REST 請求,每次都會拿到what u want .
5. The biggest feature of rest:
rest 提倡all apis are based on resources.
Our apis ,從本質來講,都是對資源的狀態進行改變,This is the bigest biggest feature of REST.
比如:db里的data,實際上都是一種resource.
在很多框架里,they all call the rest 資源,
比如在tp5里,提供對rest的支持,tp5給起命名為:資源控制器。
在rest的服務里,提倡使用動詞來操作resource,動詞有:get, post, put , delete
主要是這四個操作。
6. 傳統的web開發中的get、post 和rest中的get、post的區別;
答: 從技術來講沒區別,但從意義來件,區別很大。
在傳統web開發中選擇get、post并不是依據資源的crud,比如你可能使用get去刪數據,這一點在傳統開發中沒問題的,但在rest開發中是絕對da me . 因為在rest里,get表示查詢操作,而用查詢操作去刪除數據,語義不明確。
<blockquote>總結:1.在傳統開發中,選擇get、post的依據:如果你的數據足夠簡單,whatever u C,D,U,choose **get **,If params is complex , like submit a form, choose post
??????????2.在rest中,Choose get or post, it depends on your operation,like query , create </blockquote>