PHP is_executable() 函數


PHP Filesystem 參考手冊 完整的 PHP Filesystem 參考手冊

定義和用法

is_executable() 函數檢查指定的檔是否可執行。

如果檔可執行,該函數返回 TRUE。

語法

is_executable(file)

參數 描述
file 必需。規定要檢查的檔。


提示和注釋

注釋:該函數的結果會被緩存。請使用 clearstatcache() 來清除緩存。

注釋:自 PHP 5.0 版本起,is_executable() 函數可用於 Windows。


實例

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

上面的代碼將輸出:

setup.exe is executable


PHP Filesystem 參考手冊 完整的 PHP Filesystem 參考手冊