[Solved]Fatal error: Call to undefined function base_url() in Codeigniter

[Solved]Fatal error: Call to undefined function base_url() in Codeigniter

In this post, I will let you know how to fix the issue "Call to undefined function base_url()" in Codeigniter.

When i was started with Codeigniter then i had faced some fatal error like this :

Call to undefined function base_url() in C:\wamp\www\Demo-CI\application\views\\products\list.php on line 5

I was getting an error because I did not load the url helper to access that function.

I put url in autoload file and you will find the autoload.php in following path application/config/autoload.php.

$autoload['helper'] = array('url');

Save your autoload.php file and run your application, base_url() function will work now.

Alternately, you can add following line of code somewhere in controller :

$this->load->helper('url');

Phone: (+91) 8800417876
Noida, 201301