Replacing backslashes with forward slashes with str_replace() in php

前端 未结 6 1729
花落未央
花落未央 2020-12-09 14:29

I have the following url:

$str = \"http://www.domain.com/data/images\\flags/en.gif\";

I\'m using str_replace to try and replac

6条回答
  •  情深已故
    2020-12-09 15:09

    Single quoted php string variable works.

    $str = 'http://www.domain.com/data/images\flags/en.gif';
    $str = str_replace('\\', '/', $str);
    

提交回复
热议问题