你應該可以做到這一點,只需更換app/config/routes.php
的這一部分:
/**
* Here, we are connecting '/' (base path) to controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/views/pages/home.ctp)...
*/
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
..像這樣的東西:
/**
* Here, we are connecting '/' (base path) to controller called 'Users' and
* its action called 'dashboard' (ie. /users/dashboard)...
*/
Router::connect('/', array('controller' => 'users', 'action' => 'dashboard'));
我感覺到話題的意見稍有分歧,當您嘗試從「/pages/home
」映射到您的儀表板。 '/pages/home
'只是看起來像主頁,因爲存在這樣的路線。如果您想更改主頁,則需要更改現有的Router::connect('/', ...)
規則。如果您爲'/
'創建新規則,則在下面,它不會被執行,因爲CakePHP將匹配找到的第一個路由。
什麼控制器/操作正在運行? – inkedmn 2009-09-16 12:27:29