you can get base url of codeIgniter applicatoin with $this->config->base_url();
, you can also call base_url(), but to use the function you need to load codeigniter URL helper.
How to load CodeIgniter URL Helper ?
you can load this with in controller constructor or with in the Method
$this->load->helper('url');
Or you can autoload it by changing application/config/autoload.php
/* | ------------------------------------------------------------------- | Auto-load Helper Files | ------------------------------------------------------------------- | */ $autoload['helper'] = array('url');