PHP Pre-Processing with XMake: Customization |
>> << Simulated Server: source |
<?php
function createLink($file){
// $file is the absolute path to a file below $DOCUMENT_ROOT
// we must strip off $DOCUMENT_ROOT from the path
if ( 0 != strncmp ( $_SERVER["DOCUMENT_ROOT"], $file, count($_SERVER["DOCUMENT_ROOT"])) ){
trigger_error( 'File is outside $_SERVER["DOCUMENT_ROOT"]: '."$file");
}
$link = str_replace($_SERVER["DOCUMENT_ROOT"],'/', $file);
return $link ;
}
echo '$_SERVER["DOCUMENT_ROOT"]='.$_SERVER["DOCUMENT_ROOT"]."<br>\n";
echo '$_SERVER["SCRIPT_FILENAME"]='.$_SERVER["SCRIPT_FILENAME"]."<br>\n";
echo 'A generated absolute link from DOCUMENT_ROOT: '.createLink(dirname($_SERVER["SCRIPT_FILENAME"]).'/')."<br>\n";
?>
>> << Copyright (c) 2003, Gregory Keranen. All rights reserved. |