[resolved]
Date: 05/19/05
(PHP Community) Keywords: php
RESOLVED
The following code is part of my vars.php file:
$path = basename($_SERVER['SCRIPT_FILENAME']);
$newpath = str_replace('.php','',$path);
When I echo $newpath
, it shows me the filename minus the .php at the end, which it's supposed to do. This suggests to me that $path
is working as it should, and has picked up the filename.php - right?
(EG. file might be index.php, so $path
is index.php and $newpath
is index)
So, why is it that when I echo $path
, it shows: URL
(source: URL
)
..which incidently is the last variable in my vars.php file. What I don't get is why $newpath
is worked out okay from what is obviously the right path, but $path
echos as something completely different? I can't for the life of me figure out why it's echoing the wrong thing. What am I missing?
EDIT: Even if I remove the $url
variable from the vars.php file altogether, echoing $page
still echos the crap that WAS in $url
. wtf?
vars.php
$ip = $_SERVER['REMOTE_ADDR'];
$browser = getenv('HTTP_USER_AGENT');
$ref = getenv("HTTP_REFERER");
$path = basename($_SERVER['SCRIPT_FILENAME']);
$newpath = str_replace('.php','',$path);
$xhtml = "XHTML";
$css = "CSS";
$html = "HTML";
$w3c = "W3C";
$php = "PHP";
$os = "OS";
$path = "URL";
$asap = "ASAP";
$msie = "MSIE";
$ict = "ICT";
$mysql = "MySQL";
$url = "URL";
?>
other file
include('header.php'); ?>
=$path;?>
include('footer.php'); ?>
..the vars.php is included (require_once('vars.php');
) in the header.php file
Source: http://www.livejournal.com/community/php/299614.html