Home >Backend Development >PHP Tutorial >php is_file determines the existence of a file_PHP tutorial

php is_file determines the existence of a file_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 16:59:291018browse

We used the file_exists and is_file functions to determine whether it is a file and whether the file exists. Here we have some special instructions for the path. Friends in need can refer to it.

//User determines whether the article exists is_file file_exists function implementation

 代码如下 复制代码
 function isFile($path)
 {
  if( file_exists($path) && is_file($path))
 {
  return true;
 }
 else
 {
  return false;
 }
 }

//Note that the is_file and file_exists functions cannot determine the absolute path. For example, my $_path ='/upfile/' above will show that the file cannot be found. If you use ../upfile/, it will be OK.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631316.htmlTechArticleWe use the file_exists and is_file functions to determine whether it is a file and whether the file exists. Here we talk about the path Here’s a special note, friends in need can refer to it. ...
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