将允许的类型放入数组并使用
in_array()。
$file_type = $_FILES['foreign_character_upload']['type']; //returns the mimetype$allowed = array("image/jpeg", "image/gif", "application/pdf");if(!in_array($file_type, $allowed)) { $error_message = 'only jpg, gif, and pdf files are allowed.'; $error = 'yes';}


