URL agreement for router - Raysmond/FDUGroup GitHub Wiki
The whole web application is started first of all from index.php. In order to resolve the url exactly into
concrete controller and action, so the first thing is to normalized the url request. I have made an agreement on the url forms, other casual forms are not supported by the framework, so that's important.
For example:
http://localhost/FDUGroup/index.php?q=site/view/24This is a supported url. The application will invoke router(RRouter) to resolve the url into meaningful information. For this case, the result is:
array( 'controller'=>"site", // the unique ID of the SiteController 'action'=>"view", // the unique ID of an action of the controller 'params'=>array( // parameters passed to the action method [0]=>24 ) )
Then, the application will create a controller instance of SiteController identified by "site". The controller will create an action identified by "view" and run a corresponding method (actionView()). And the parameters will be passed to be method.
Just like we run the following codes:
$controller = new SiteController(); $controller->actionView(24);
If there're more than one parameter for an action, for example:
public function actionView($param1,$param2){ }
Then, the correct URL request should like:
http://localhost/FDUGroup/index.php?q=site/view/1/2