Last active
December 11, 2015 18:38
-
-
Save shahariaazam/4642401 to your computer and use it in GitHub Desktop.
Platform Independent DIRECTORY_ SEPERATOR constant in php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function TestPath() | |
{ | |
return __DIR__.DIRECTORY_SEPARATOR."somefile.php"; | |
} | |
var_dump(TestPath()); | |
/* | |
* it will return something like string 'C:\xampp\htdocs\LibComponent\Multimedia\somefile.php' (length=58) | |
* In this case DIRECTORY_SEPERATOR constant is "\" if I want to require somefile.php then this type of path will not work | |
* but to make it work I need C:/xampp/htdocs/LibComponent/Multimedia/somefile.php | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment