preg_replace problem
I have $_SERVER['DOCUMENT_ROOT']
echoed, the problem is when it is echoed from xampp it shows, like this:
C:/xampp/hdocs
and开发者_StackOverflow社区 when echoed from PHPed it shows
C:\\xampp\\htdocs.
I want to replace "C:\\xampp\\htdocs"
with "C:/xampp/hdocs"
but I'm not able to do so using preg_replace
.
Kindly help me !
You don't need regex for that. Use the str_replace()
fnction:
str_replace('\\', '/', $str);
精彩评论