Home  >  Article  >  Backend Development  >  php is_executable determines whether the given file name is executable instance

php is_executable determines whether the given file name is executable instance

高洛峰
高洛峰Original
2016-12-21 16:14:241239browse

php is_executable function is used to determine whether a certain file can be executed. If the file exists and is executable, it returns TRUE. If an error occurs, it returns FALSE. This article introduces you to the basic syntax and usage examples of the is_executable function.

php is_executable function introduction

is_executable function is used to determine whether the given file name is executable

Syntax:

bool is_executable ( string $filename )

Determine whether the given file name is executable.

Parameters:

filename The path to the file.

Return value:

TRUE if the file exists and is executable, FALSE on error.

php is_executable function example

Use is_executable to determine whether the permissions.php file is executable. The code is as follows:

<?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 />");
}
?>

The above is the collection of information on php is_executable to determine whether a given file name is executable. We will continue to add related information in the future. Information, thank you for your support of this site!

For more articles on php is_executable to determine whether a given file name is executable, please pay attention to the PHP Chinese website!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn