phpmady Posted May 27, 2010 Share Posted May 27, 2010 Hi, How to get the root of the folder, actually am in the file.. http://localhost/project/admin/test.php how to get the project folder Thanks Link to comment https://forums.phpfreaks.com/topic/203113-get-the-root-of-the-folder/ Share on other sites More sharing options...
ChaosKnight Posted May 27, 2010 Share Posted May 27, 2010 Is this what you are looking for?: $_SERVER['PHP_SELF']; Link to comment https://forums.phpfreaks.com/topic/203113-get-the-root-of-the-folder/#findComment-1064241 Share on other sites More sharing options...
phpmady Posted May 27, 2010 Author Share Posted May 27, 2010 Is this what you are looking for?: $_SERVER['PHP_SELF']; No i want to get only the project folder Link to comment https://forums.phpfreaks.com/topic/203113-get-the-root-of-the-folder/#findComment-1064247 Share on other sites More sharing options...
The Eagle Posted May 27, 2010 Share Posted May 27, 2010 Well, you have to elaborate more, we cannot go to that localhost as it is on your computer, what exactly do you want to do? <a href="/">this?</a> Link to comment https://forums.phpfreaks.com/topic/203113-get-the-root-of-the-folder/#findComment-1064250 Share on other sites More sharing options...
phpmady Posted May 27, 2010 Author Share Posted May 27, 2010 hi, myproject_folder/admin/test.php just i want to get the myproject_folder thanks Link to comment https://forums.phpfreaks.com/topic/203113-get-the-root-of-the-folder/#findComment-1064253 Share on other sites More sharing options...
phpmady Posted May 27, 2010 Author Share Posted May 27, 2010 Well, you have to elaborate more, we cannot go to that localhost as it is on your computer, what exactly do you want to do? <a href="/">this?</a> hi, myproject_folder/admin/test.php just i want to get the myproject_folder thanks Link to comment https://forums.phpfreaks.com/topic/203113-get-the-root-of-the-folder/#findComment-1064259 Share on other sites More sharing options...
jskywalker Posted May 27, 2010 Share Posted May 27, 2010 take a look at: http://nl3.php.net/manual/en/function.getcwd.php if you are in : myproject_folder/admin/test.php than: getcwd() will echo "myproject_folder/admin/" chdir("..") (http://nl3.php.net/manual/en/function.chdir.php) will take you to "myproject_folder/" Link to comment https://forums.phpfreaks.com/topic/203113-get-the-root-of-the-folder/#findComment-1064275 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.