2011-11-19 272 views
-3

我有這個字符串:image/fewe,我想用別的東西替換,但我不知道我將如何去做,也許有任何幫助?用特殊字符替換字符串

+3

請說明您準確地使用了哪個字符串(例如'image/fewe'或'image/fewe <-'或其他),您要替換的內容,要替換的內容以及要獲取的結果。 –

+0

@draevor它在標題,標記和幫助內容中。 –

+0

@draevor問題用php標記,問題標題也以PHP:爲前綴。所以,PHP。 (我們必須假設) –

回答

0
str_replace("replace_me", "replace_with", 'image/fewe'); 

preg_replace() // you'll need to look that up to match your regex with your needs. 

不知道你在找什麼。

+0

謝謝你,第一個(str_replace)工作:-) –

0
$string = 'image/fewe'; 
$replaceItWith = 'another string'; 
$result = str_replace('image/fewe', $replaceItWith, $string); 

如果你要搜索的模式在一個字符串,然後使用preg_replace()