4
$filename = '/www/test1/*.pdf';
    if (file_exists($filename)) 
    {
        echo "The file $filename exists";
    } 
    else
    {
        echo "The file $filename does not exist";
    }

我使用了上面的代码,但它检查 *.pdf 文件但不是所有文件都属于 .pdf 扩展名

4

1 回答 1

10
$filename = '/www/test1/*.pdf';
if (count(glob($filename)) > 0) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";
}
于 2013-05-29T12:52:48.567 回答