is_executable() 函数检查指定的文件是否可执行。
is_executable(file)
如果文件存在且可执行,则返回 true。
注释:本函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。
注释:is_executable() 自 PHP 5.0.0 版起可用于 Windows。
<?php $file = "setup.exe"; if(is_executable($file)) { echo ("$file is executable"); } else { echo ("$file is not executable"); } ?>
输出:
setup.exe is executable