PHP is_executable()Function


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

Definition and Usage

The is_executable() function checks whether the specified file is executable.

Returns TRUE if the file is executable.

Syntax

is_executable(file)

Parameters Description
file Required. Specifies the file to check.


Tips and Notes

Note:The results of this function are cached. Use clearstatcache() to clear the cache.

Note:As of PHP 5.0, the is_executable() function can be used on Windows.


Examples

<?php
$file = "setup.exe";
if(is_executable($file))
{
echo ("$file is executable");
}
else
{
echo ("$file is not executable");
}
?>

The code above will output:

setup.exe is executable


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual Other Extensions