-
- $filename = '/jbxue.com/aa/to/foo.txt';
- if (file_exists($filename)) {
- echo "File $filename exists";
- } else {
- echo "File $filename does not exist";
- }
- ?>
Copy code
Output result:
The file /jbxue.com/aa/to/foo.txt already exists
Example 2:
-
- echo file_exists("jbxue.com.txt");
- ?>
-
Copy code
Directly use file_exists to return true or false
|