bool
in_array (
mixed
$needle
,
array $haystack
[,
bool $strict
= FALSE
] )
Searches haystack
for needle
using loose comparison unless strict
is set.
<?php
$ext = "PPT";
$ext = strtolower($ext);
$file_ext = array("doc", "ppt", "xls", "docx","xlsx","pptx","txt");
if (in_array($ext, $file_ext)) {
echo "文档类型";
}else{
echo "其他类型";
}
?>