【发布时间】:2012-01-06 11:05:19
【问题描述】:
喂。 我有 2 个控制器,第一个 application/classes/controller/welcome.php 和第二个 application/classes/controller/admin/welcome.php。
我有以下路由,在 bootstrap.php 中设置
Route::set('admin', '(<directory>(/<controller>(/<action>(/<id>))))', array('directory' => '(admin)'))
->defaults(array(
'directory' => 'admin',
'controller' => 'welcome',
'action' => 'index',
));
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
如果我访问 example.com/welcome,它会从 application/classes/controller/welcome.php 控制器调用 index 操作(此很好), 如果我访问 example.com/admin/welcome 它会从 application/classes/controller/admin/welcome.php 控制器调用 index 操作(这很好),
但如果我只是访问 example.com,它会调用管理员的欢迎而不是其他的,我不明白为什么。
我想要这个:如果我访问 example.com,然后从 application/classes/controller/admin/welcome.php调用 index 操作> 控制器。 我该如何解决这个问题?
【问题讨论】:
-
非常好,很高兴为您提供帮助 :) 如果您可以将问题标记为已回答,那么将来搜索该问题的人们会更容易找到解决方案。谢谢!