Routing
With resource and controller classes ready, you can access the resources using the URL like http://localhost/index.php?r=user/create
, similar to what you can do with normal Web applications.
In practice, you usually want to enable pretty URLs and take advantage of HTTP verbs. For example, a request POST /users
would mean accessing the user/create
action. This can be done easily by configuring the urlManager
application component in the application configuration like the following: