php判断文件是否存在:
file_exists函数 — 检查文件或目录是否存在
代码:
<?php
$file = "gaojiufeng.txt";
if(file_exists($file))
{
echo "文件".$file."存在";
}
else
{
echo "文件".$file."不存在";
}注意事项:
在 Windows 中要用 //computername/share/filename 或者 \\computername\share\filename 来检查网络中的共享文件。