is_executable 判断给定文件名是否可执行 php函数


is_executable

(PHP 4, PHP 5)

is_executable判断给定文件名是否可执行

说明

bool is_executable ( string $filename )

如果文件存在且可执行则返回 TRUE

is_executable() 自 PHP 5.0.0 版起可用于 Windows

Example #1 is_executable() 例子

<?php

$file 
'/home/vincent/somefile.sh';

if (
is_executable($file)) {
    echo 
$file.' is executable';
} else {
    echo 
$file.' is not executable';
}

?>

Note: 此函数的结果会被缓存。参见 clearstatcache() 以获得更多细节。

Tip

自 PHP 5.0.0 起, 此函数也用于某些 URL 包装器。请参见 Supported Protocols and Wrappers以获得支持 stat() 系列函数功能的包装器列表。

参见 is_file()is_link()


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3