问问题
551 次
3 回答
3
或者,如果您想使用 RegEx,请使用:
$str = 'a“bc”def°g';
$str = preg_replace("[^A-Za-z0-9 ]", "", $str);
于 2010-10-27T12:40:02.147 回答
0
一种方法是(例如)
$str = 'a“bc”def°g';
$special = array('“','”','°');
$str = str_replace($special,'',$str);
于 2010-10-27T12:38:31.460 回答
0
根据编辑-读取文件内容,删除除字母数字和空格字符之外的所有内容,然后将结果写入同一文件,您可以使用:
$file= "yourfile.txt";
$file_content = file_get_contents($file);
$fh = fopen($file, 'w');
$file_content=preg_replace("[^A-Za-z0-9 ]", "", $file_content);
fwrite($fh, $file_content);
fclose($fh);
于 2010-10-27T14:44:59.640 回答