I am little bit confused on how routes work in codeiIgniter. I have set up this following route
$route['myfirstest'] = 'Blogs';
I then set up a php file called blogs.php under the application/controllers directory
When I run the following URL
/code_igniter/index.php/myfirstest/hello/hello
I get a 404 message
However when I run this following URL
/code_igniter/index.php/blogs/hello/hello
It works find
Can anyone please help me figure this out..Maybe I am not getting the whole route thing correctly..
I think this will work for you
$route['myfirstest'] = 'Blogs';
$route['myfirstest/(:any)'] = "Blogs/$1"
This will also work for you.But I don't think this is your real purpose.
$route['myfirstest/hello/hello'] = "Blogs/hello/hello";
If you want any value inside hello function you can write this way
$route['myfirstest/hello/(:any)'] = "Blogs/hello/$1";
Remember for 2nd and 3rd solution you also need to write
$route['myfirstest'] = 'Blogs';
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.