Are there any predefined variables in php that display the directory that the script is currently being run? The first directory; I mean, not the full path since the doccument root.
If not, is there any way to work around it/remove certain text from a string?
Name:
Anonymous2006-01-01 20:14
1 get full path from $_SERVER['PHP_SELF']
2 split it using EXPLODE into array
3 get whichever item of array you want
4 profit
but maybe i have misunderstood it..
Name:
12006-01-01 23:38 (sage)
>>2
Actually I found a solution to this thanks to #php. I ended up using a combination of substr(), strpos(), and strrpos().
Name:
12006-01-01 23:38 (sage)
>>2
Actually I found a solution to this thanks to #php. I ended up using a combination of substr(), strpos(), and strrpos().
Name:
Anonymous2006-01-02 3:45
>>4
basename(dirname($_SERVER[PHP_SELF])) is the "official" way to do it, I expect, and might be more readable.
More problems:
Warning: main(/dynamic.php): failed to open stream: No such file or directory in /var/www/com/general/dyn.php on line 3
Warning: main(): Failed opening '/dynamic.php' for inclusion (include_path='.') in /var/www/com/general/dyn.php on line 3
I keep on getting those two errors, no matter what I try. I've tried to include the file by changing how I request it, I've tried to include the file via HTTP, I've even tried to include the file by changing the include path; I've tried all sorts of things but I can't get it to work. What's the problem?
Name:
Anonymous2006-01-12 17:25
remove the slash
Name:
Anonymous2006-01-12 18:32
>>8
I've tried that. The file is in the main www directory, so I was trying to access it that way.
Name:
Anonymous2006-01-13 2:10 (sage)
if you mean /var/www then you might want to check your current directory right before you get that error. I think you are looking in the wrong path.