3 に答える
3
Or, if you want to use a RegEx, use:
$str = 'a“bc”def°g';
$str = preg_replace("[^A-Za-z0-9 ]", "", $str);
于 2010-10-27T12:40:02.147 に答える
0
One way would be (eg)
$str = 'a“bc”def°g';
$special = array('“','”','°');
$str = str_replace($special,'',$str);
于 2010-10-27T12:38:31.460 に答える
0
Per the edit- to read the file contents, remove everything except alphanumerics and space characters then write the result to the same file, you can use:
$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 に答える