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:  Magento 2 How to solve one or more indexers with Reindexing using Command

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:  Laravel 6 WhereNotIn Query Example

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.

Read Also:  Codeigniter File Download Helper - Download file from database - URL using Server

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

Your email address will not be published. Required fields are marked *