3

I'm working on an adminpanel within CakePHP.

I have UsersController.php in app/plugins/Users/Controllers/

if I go to {site_url}/admin/users/ I get a list of all users. But when I want to add or edit an user with {site_url}/admin/users/add or {site_url}/admin/users/edit/1

I get the following error:

Error: UsersController could not be found.

Error: Create the class UsersController below in file: app/Controller/UsersController.php

Routers:

Router::connect('/admin/:controller/:action/*', array(
    'action' => null, 'prefix' => 'admin', 'admin' => true
)); 

Router::connect('/admin', array('plugin' => 'Users', 'controller' => 'users', 'action' => 'dashboard', 'admin' => true, 'layout' => 'admin'));
    
if ($plugins = App::objects('plugin')) {
    $pluginMatch = implode('|', array_map(array('Inflector', 'underscore'), $plugins));
    Router::connect(
        "/admin/:plugin/:controller/:action/*",
        array('action' => null, 'prefix' => 'admin', 'admin' => true),
        array('plugin' => $pluginMatch)
    );
} 
4

1 回答 1

3

为什么不直接使用已经提供的有效路由(使用前缀路由)?

https://github.com/cakephp/cakephp/blob/master/app/Config/routes.php#L45

于 2013-07-01T10:32:12.950 回答