我有一个文本文件,它看起来是这样的: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