我有一個文本文件,它看起來是這樣的:PHP刪除所有空格後的特定字符
What word is on page 9, 4 words from the left on line 15? account
What word is on page 11, 2 words from the left on line 5? always
有沒有一種方法,我可以後刪除所有空間的「?」所以它看起來是這樣的(空間量在整個實際的文本文件中的所有不同):
What word is on page 9, 4 words from the left on line 15?account
What word is on page 11, 2 words from the left on line 5?always
瞭解裝飾函數 – samayo 2013-02-11 17:49:09
@PHPNooB修剪函數從字符串的開頭或結尾刪除字符,而不是中間字符。 – 2013-02-11 17:50:34
你需要一個正則表達式來匹配'?'+空格並用'?'替換 - ''\?\ s +''是那個表達。在'preg_replace'中使用它... – Floris 2013-02-11 17:51:17