call to undefined function base_url() Fixed

Rate this post

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:  Dropdown Validation using Angular Example

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');

Free Live Chat for Any Issue

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:  php array push - Best 3 Ways To add elements to an empty array in PHP?

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');

Download

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