codeigniter routes with parameters

Today, We want to share with you codeigniter routes optional parameter.In this post we will show you codeigniter route optional parameter, hear for codeigniter 4 routes we will give you demo and example for implement.In this post, we will learn about Codeigniter 3 Get All Routes Using Controller with an example.

Codeigniter controllers subfolders

Codeigniter controllers subfolders Example

<?php 
defined('BASEPATH') OR exit('No direct script access allowed'); 

class Login extends CI_Controller { 	 	

	public function index()
	{ 		

		$this->load->view('login_view');

	}
}

nice clean URL of:

Read Also:  PHP Get Whatsapp Password ID and whatsapp token

http://pakainfo.com/account/manage/4123245/jakub

// sub directories

/application/controllers/account/manage.php

Understand your route

/application/config/routes.php

$route['account/manage/(:num)/(:any)']  = "account/manage/index/$1/$2";

manage.php controller

<?php
class Manage extends CI_Controller {
 
    public function index($id, $membername)
    {
        // do something here with the two values
    }
 
}
?>

I hope you get an idea about dynamic routing in codeigniter.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.