View Single Post

  #8 (permalink)  
Old 05-14-2008
Rik Wasmus
 
Posts: n/a
Default Re: require_once() ... gone mad? !

Tim Roberts wrote:
> Ronald Raygun <invalid@domain.com> wrote:
>> ...
>> Contents of app_config.php
>> ===========================
>> <?php
>> function fix_trailing_char($pathname){
>> $fixedname = $pathname[strlen($pathname)-1] == "/" ? $pathname :
>> $pathname. "/" ;
>> return $fixedname;
>> }
>>
>> define("DOC_ROOT", fix_trailing_char(dirname($_SERVER["DOCUMENT_ROOT"])));
>> define("CLASS_ROOT", DOC_ROOT . "classes/");
>> define("CONFIG_ROOT", DOC_ROOT . "global/");
>>
>> ?>

>
> Does PHP on Windows guarantee that $_SERVER["DOCUMENT_ROOT"] uses forward
> slashes and not backslashes? I didn't realize that. My extensive
> empirical tests (i.e., 1 system) shows that it seems to be true, but is
> that in the documentation?


AFAIK, it is always the case, but I see no guarantee. Mixing it up in
PHP ('C:\path\sub\adh/asd/asd/asd') is no problem though, and the
escaping problem (double your \'s) has allready been passed, the string
is OK.
--
Rik Wasmus
[SPAM]
Now looking for some smaller projects to work on to fund a bigger one
with delayed pay. If interested, mail rik at rwasmus.nl
[/SPAM]
Reply With Quote