Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the project basepath in CodeIgniter

Tags:

codeigniter

I have created a folder as user in the root directory.

My project base path is:

/var/www/myproject/ 

When I want to access the base path as BASEPATH from a controller it's showing:

/var/www/myproject/system/  

But I want the path to be:

/var/www/myproject/  

I am new to CodeIgniter. How do I set this path?

like image 472
Alok Das Avatar asked Jun 19 '13 10:06

Alok Das


2 Answers

Use FCPATH instead of BASEPATH for more check this link.

Codeigniter - dynamically getting relative/absolute path outside of application folder

like image 117
Amar Banerjee Avatar answered Sep 29 '22 21:09

Amar Banerjee


use base_url()

echo $baseurl=base_url(); 

if you need to pass url to a function then use site_url()

 echo site_url('controller/function'); 

if you need the root path then FCPATH..

echo FCPATH; 
like image 22
bipen Avatar answered Sep 29 '22 21:09

bipen