I have folder hierarchy
---protected
------...
------controller
---------admin
------------OneController.php
------------TwoController.php
---------user
------------ThreeController.php
------------FourController.php
also i add them in main.php as
'import' => array(
'application.models.*',
'application.forms.*',
'application.components.*',
'application.fetcher.*',
'application.controllers.admin.*',
'application.controllers.user.*', ...
add route for admin
'urlManager' => array(
'showScriptName' => false,
'urlFormat' => 'path',
'rules' => array(
// ...
'admin' => 'admin/one/index',
but this doesn't work, can you help to deal with it? I want do simply routes to subfoldered controllers.
I think your syntax of rule is wrong. Try to use
'rules' => array(
'admin' => 'admin/one/index'
)
I Found solution. My mistake was on controller, I have default (old) OneController in /protected/controllers that's why routes give me 'old' data, when I change name of (old) OneController, trouble gone. And after that route give me new one from /protected/controllers/admin/OneController.
it was like this one
---protected
------...
------controller
---------OneController.php <-- this gives wrong data even error because of routes
---------admin
------------OneController.php
------------TwoController.php
---------user
------------ThreeController.php
------------FourController.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.