檢查您的應用程序/根目錄/ index.php文件,底部:
$Dispatcher = new Dispatcher();
$Dispatcher->dispatch(
new CakeRequest(),
new CakeResponse()
);
調度程序的關鍵方法是parseParams。此方法在Dispatcher :: dispatch()開始時通過事件系統觸發,並在類中檢查該方法。
發生了什麼基本上是調度員使用路由器來解析普通網址並將其轉換爲參數,並將解析結果添加到請求對象,然後根據解析結果調度控制器。
/**
* Applies Routing and additionalParameters to the request to be dispatched.
* If Routes have not been loaded they will be loaded, and app/Config/routes.php will be run.
*
* @param CakeEvent $event containing the request, response and additional params
* @return void
*/
public function parseParams($event) {
$request = $event->data['request'];
Router::setRequestInfo($request);
$params = Router::parse($request->url);
$request->addParams($params);
if (!empty($event->data['additionalParams'])) {
$request->addParams($event->data['additionalParams']);
}
}
請問一個確切的問題。你目前的這個問題太廣泛了,目前還不清楚你感興趣的是什麼。 – fuesika