我正在設置路由到控制器,並且不斷收到404或「銀河系框架入門」頁面。控制器路由不按預期在銀條中工作3.1
在routes.yaml我:
---
Name: nzoaroutes
After: framework/routes#coreroutes
---
Director:
rules:
'view-meetings/$Action/$type': 'ViewMeeting_Controller'
我的控制器看起來是這樣的:
class ViewMeeting_Controller extends Controller {
public static $allowed_actions = array('HospitalMeetings');
public static $url_handlers = array(
'view-meetings/$Action/$ID' => 'HospitalMeetings'
);
public function init() {
parent::init();
if(!Member::currentUser()) {
return $this->httpError(403);
}
}
/* View a list of Hospital meetings of a specified type for this user */
public function HospitalMeetings(SS_HTTPRequest $request) {
print_r($arguments, 1);
}
}
而且我已經創建了一個模板(ViewMeeting.ss),單純輸出$內容,但當我刷新站點緩存並訪問/查看會議/ HospitalMeetings/6?flush = 1
我得到默認的'Silverstripe框架入門'頁
我知道routes.yaml路由工作,因爲如果我改變路線那裏,參觀古老的URL,我收到了404,但請求似乎並沒有解僱我的$行動......