如何寫只接受數字和alphabetics如何讓函數只接受PHP POST中的數字和字母?謝謝大家
function clean_post($_POST) {
foreach($_POST as $key=>$value) {
$cleaned_value = mysql_real_escape_string($value);
$cleaned_value = str_replace('(','', $cleaned_value);
$h_cleaned_array[$key] = $cleaned_value;
}
return $h_cleaned_array;
}
你見過http://in2.php.net/preg_replace –
查看一般正則表達式。 – Boaz