I am wondering if this is at all possible. There are lots of questions on the subject in SO, but none address this specific issue.
I have a symlink that looks like this:
reroof-for-abe-froman.php -> /var/www/yourprojects/app/project.php
Now all I want returned from a variable is reroof-for-abe-froman
with, or without the extension (preferably without).
I have tried all of these:
echo basename(__FILE__, '.php') . "\n";
echo $_SERVER['REQUEST_URI'] . "\n";
echo $_SERVER['SCRIPT_FILENAME'] . "\n";
echo __FILE__ . "\n";
With the following results:
project
/project/reroof-for-abe-froman
/var/www/liveSites/websites/allseasonsny/public_html/project/reroof-for-abe-froman.php
/var/www/yourprojects/app/project.php
Now I realize I can use $_SERVER['REQUEST_URI']
and str_replace
or explode
to get what I want. IE:
$uri = str_replace('/project/', '', $_SERVER['REQUEST_URI'])
Which would give the desired output. I was just wondering if there was a "cleaner" way to accomplish this without the manipulation of a _SERVER
variable?