Call to undefined function base_url() in CI 3.x version
Codeigniter updated their version time to time for upgrade its functionality and features. There are latest version is 3.x. I noticed that in installation process developers face a problem while use of base_url. Today I discuss how to fix Call to undefined function base_url() in 3.x version.
I get this error when I did not set URL helper in autoload.php (folder application/config). I share you solution for fix this error. find this code in autoload.php.
1 2 3 4 5 6 |
//actual code in autoload.php $autoload['helper'] = array(); |
and replace with it
1 2 3 4 5 6 |
//update this code in autoload.php $autoload['helper'] = array('url'); |
You can add this helper in direct controller’s constructor but this method work for only one controller so above is good one:
1 2 3 4 5 6 7 8 9 |
function __construct() { parent::__construct(); //load helper url $this->load->helper('url'); } |
Thanks for visiting. Happy Learing 🙂