我無法找到url管理器的邏輯。任何機構都可以告訴我關於在Rest模式下給定的URL調用。我的控制器中有很多隻有單參數的get方法。Yii Rest api url manager
這是我的原始地址:本地主機/項目/ API /事件/ getevent/EVENT_ID/1
的API模塊 事件控制器 getevent是控制器動作的名稱 事項標識爲參數1
我要將此轉換爲REST模式localhst /項目/ API /事件/ 1
//更新代碼..
所有都涉及到相同型號............. 。
//Search by Event id
public function actionByEventId(){
$model->byEventId();
}
//Retrieve user's events by User id
public function actionByUserId()
{
$model->userEvents();
}
//Search for event by code
public function actionByEventcode()
{
$model->byEventCode();
}
你可以作爲添加如何打電話給他們?比如'localhst/project/api/event/1'和'localhst/project/api/user/1'? – Dinistro 2014-10-29 10:31:29
不,我想要這個localhst/project/api/event/eventid/1和localhst/project/api/event/userid/1 – Kishore 2014-10-29 10:52:26
編輯答案 – Dinistro 2014-10-29 11:10:26