sradha
sradha

Reputation: 2244

Router management in CI 3

I need router management in my project.

My url is some thing like it.

http://localhost/cloud/index.php/dashboard/view_tickets/wsyZCMuIEavPeWdRHqjJ

Here i want to replace "dashboard/view_tickets" as one word "tickets"

but i have tried using routers, its not working.

Router code:

$route['ticket/(:num)'] = 'Ticket/view_tickets/$1';

Here $1 is for num, but here my parameter has string only.

Any suggestion?

Thank you.

Upvotes: 1

Views: 65

Answers (1)

Deniz B.
Deniz B.

Reputation: 2562

Change this:

$route['ticket/(:num)'] = 'Ticket/view_tickets/$1';

To this:

$route['ticket/(:any)'] = 'Ticket/view_tickets/$1';

To make it work, you should create a function called "view_tickets" under "Ticket" class (Controller).

Also please see here to understand routing in Codeigniter.

Upvotes: 2

Related Questions