Defining a default controller for a folder in Codeigniter
Hey everyone, I have my Codeigniter controllers set up in a folder called employees. The issue is that I don't seem to know the best way to specify the default controller if only the folder is typed in the URL. For instance, I would like to be able to type in:
www.mysite.com/employees
and have it d开发者_运维百科efault to the personnel controller, instead of having to type in:
www.mysite.com/employees/personnel
Any ideas? Thanks.
How have you specified it in your routes.php
? Have you tried with:
$route['default_controller'] = "personnel";
Simple - just add an "index()" function
class Employees extends CI_Controller
{
public function index()
{
redirect ('employees/personnel');
}
public function personnel()
{
// your code here
}
}
精彩评论