strange thing with path - slash or backslash?

Hi all

while debbuging a 404 not found of an image file i noticed something strange

i ran this php builtin func to get cuurent path on runtime:

[size="4"]$curPath = getcwd ();

i got this value :



and Yii::getAlias returnes this value:



one is with slashes and one with backslashes

what am i missing here?

Thanks in advance…

It is a Windows specific behavior of PHP.

It is not only the case for "realpath" bat also for other functions that handle files and directories.

As a consequence, we can write a path in source code using "/" alone, stop worrying about the OS.

getcwd() returns literately the result of the getcwd sys_call depending on the OS. I would recommend you use DIR constant to figure out the directory path which returns very similar results to getcwd, let php handle all OS specific stuff internally.

for realpath function as suggested by softark you need to give it a path.