2012-12-16 45 views

回答

0

請嘗試使用雙引號\轉義字符 - 這樣的:\」

return str_replace("src=\"images/imagename.jpg\"", "src=\"http://xyz.com/images/imagename.jpg\"", $string); 

隨着通過ヶ輛傳遞兩個字符串:

return str_replace("src="images/imagename.jpg"", "src="http://xyz.com/images/imagename.jpg"", $string); 
+0

我已經試過了太$ string = htmlentities('src =「images/imagename.jpg」'); echo str_replace('src = \「images /',」http://xyz.com/images/imagename.jpg「,$ string );但這不起作用 – harikrish

+0

htmlentities會將雙引號更改爲" – Racktash

+0

我已更新我的答案,以包含替換後的htmlentities字符串。 – Racktash