Re: Directory separators on Windows
| From: | S.A.N | Date: | Fri, 31 Mar 2017 01:19:22 +0000 |
| Subject: | Re: Directory separators on Windows | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98694@lists.php.net to get a copy of this message | ||
> Another option would be to create a function that converts all slashes in a
> given input string to whatever the directory seperator should be on that
> platform. This way, devs wouldn't have to deal with bulky aliases like
> DIRECTORY_SEPERATOR cluttering up their code.
>
> For example:
>
> <?php
>
> print convert_seperators( '/some\directory/' );
>
> ?>
>
> The above would output "/some/directory" on Linux and "\some\directory" on
> Windows.
+1
Can be used, for convert NAMESPACE to filepath in autoload )
<?php
function __autoload($path)
{
include convert_seperators($path);
}