Guest convention Posted August 24, 2006 Share Posted August 24, 2006 Hi,I am wondering what I can put in the variable [code]$_SERVER[' '][/code] so the page can display what directory that page is in? For instance, if I put [code]echo "You are in directory ".$_SERVER['blah'].".";[/code] on a page that is in a directory titled "green", then it would display [code]You are in directory green.[/code]Any way to do this? Thanks! Link to comment https://forums.phpfreaks.com/topic/18521-solved-help-with-predefinded-variables-displaying-current-dir/ Share on other sites More sharing options...
Orio Posted August 24, 2006 Share Posted August 24, 2006 [code]<?php$arr=explode("/",$_SERVER['SCRIPT_NAME']);echo $arr[count($arr)-2];?>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/18521-solved-help-with-predefinded-variables-displaying-current-dir/#findComment-79757 Share on other sites More sharing options...
Guest convention Posted August 24, 2006 Share Posted August 24, 2006 Thanks for the help, Orio, however I get a "Parse error: parse error, unexpected T_VARIABLE" error on line 3... Link to comment https://forums.phpfreaks.com/topic/18521-solved-help-with-predefinded-variables-displaying-current-dir/#findComment-80059 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.