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

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

  1. $file1 ='a.txt';
  2. list($name,$ext) = explode('.',$file);
  3. echo $name;
  4. if( is_file( $name.'.txt' ) )
  5. {
  6. echo 'file存在';
  7. }
  8. if( file_exists( $file1 ) )
  9. {
  10. echo 'file1存在';
  11. }