thisFolder>xmlFiles>filename.xml
i need php to echo "thisFolder/xmlFiles/"
i have played with getcwd()
Code: Select all
<?php $p=getcwd(); echo($p."/");?>edit** i need to be clear...i just want the path, minus the file name.....
Moderator: General Moderators
Code: Select all
<?php $p=getcwd(); echo($p."/");?>Code: Select all
<?php $p=getcwd();
$yy=$_SERVER['SCRIPT_FILENAME'];
$cut=$_SERVER['SCRIPT_NAME'];
$it=strlen(basename($yy));
$x=substr($cut,0,strlen($cut)-$it);
echo ($x);
?>Code: Select all
function path($beg){ // beg is what dir you want to start at
$path = pathinfo(strstr($_SERVER['SCRIPT_FILENAME'],$beg));
return $path['dirname'];
}Code: Select all
print path('/thisFolder'); // would output /thisFolder/xmlFiles