开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜