call to undefined function base_url() Fixed

In this article, We will let you know how to fix or Solved the Codeigniter issue “Call to undefined function base_url()” in Codeigniter.

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

When we were started with Codeigniter then we had faced some fatal error like this :

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

Solution Fatal error: Call to undefined function base_url() in Codeigniter
Solution Fatal error: Call to undefineds function base_url() in Codeigniter

we were getting an error because we did not load the url Codeigniter helper to access that base_url() function.

Read Also:  Simple PHP jQuery Ajax Insert Update Delete using MySQLi

we put url in autoload file and you will find the autoload.php in following the Codeigniter web project root path like as a application/config/autoload.php.

PUT url

message: call to undefined function base_url()

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

and then you can Save your main file such as a autoload.php file and then simple you can run your Codeigniter application, like as a base_url() main function will work now.

Read Also:  8 Useful PHP Tips Tricks and Best Practices

Also Read:PHP warning: invalid argument supplied for foreach()

“Fatal error: Call to undefined function base_url()”

Alternately Way

you can included following simple set or added line of Codeigniter source code somewhere in Codeigniter MVC based controller :

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

We Hope, Above message: call to undefineds function base_url() best solution will resolve your problems whenever you will get kind of error.