CI 4 Default Landing Page

Share this Article

When we install CodeIgniter 4, we should see a default landing page which will be something like this.

How can we find it’s files from where it is coming.

Default Controller

Go inside /app/Controllers folder, you will see we have a default called Home.php.

Open that controller, it will be like this.

<?php

namespace App\Controllers;

class Home extends BaseController
{
	public function index()
	{
		return view('welcome_message');
	}
}

So, this is application default controller after installation. Inside this index() method we can see we have a view file attached welcome_message.

Default View File

Go inside /app/Views folder. We will see a default view file welcome_message.php. Inside that file we will have all the code which is responsible to render the output of landing page.

Default Route

Open Routes.php file from /app/Config folder. We will see we have default route in it as –

$routes->get('/', 'Home::index');

This route means – For landing page it has to run index() method from Home Controller. And inside index() method application returns welcome_message.php view file.

Was this post helpful?

PHP Web Development Courses on Offer in just $4
PHP Web Development Courses on Offer in just $4