当前位置:首页 > PHP教程 > PHP常见问题

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

php is_executable函数用于判断某一文件是否可以执行,如果文件存在且可执行则返回 true ,错误时返回 false, 本文章向大家介绍is_executable函数的基本语法和使用实例。

 php is_executable函数介绍

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

语法:

bool is_executable  ( string $filename  )

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

参数:

filename  文件的路径。

返回值:

如果文件存在且可执行则返回 true ,错误时返回 false 。 

php is_executable函数实例

使用is_executable判断permissions.php文件是否可以执行,代码如下:

<?php $file_name="permissions.php"; //only works on windows with php 5.0.0 or later if(is_executable($file_name)) { echo ("the file $file_name is executable.<br />"); } else { echo ("the file $file_name is not executable.<br />"); } ?>

以上就是对php is_executable判断给定文件名是否可执行的资料整理,后续继续补充相关资料,谢谢大家对本站的支持!



【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!