Home >php教程 >php手册 >php判断文件是否存在file_exists 与 is_file详解

php判断文件是否存在file_exists 与 is_file详解

WBOY
WBOYOriginal
2016-06-13 09:54:561661browse

php教程判断文件是否存在file_exists 与 is_file详解


$file ='新建 文本    文档.txt';
$file1 ='a.txt';

list($name,$ext) = explode('.',$file);
echo $name;
 
if( is_file( $name.'.txt' ) )
{
 echo 'file存在';
}

if( file_exists( $file1 ) )
{
 echo 'file1存在';
}

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