我目前正在嘗試僅過濾字母數字字符。因此,我已經嘗試了以下Zend的功能,將空白字符替換爲無效字符
$filter = new Zend_Filter_Alnum(array('allowwhitespace' => true));
$return = $filter->filter('This is (my) content: 123');
這實際上驚人的,但問題就在這裏,我需要用空格換下的字符。例如,如果我輸入「Hel#o wor * d」,它必須是「Hel o wor d」。 Aslo我已經嘗試過PHP str_replace函數,它實際上很好,但我必須定義一些無效字符。請問任何請告訴我如何輕鬆做到這一點?