file_exists php中检测文件是否存在的代码
php中检测文件是否存在的代码 [代码片段(16行)]
<?php
$fn = "/home/w3m/public_html/somefile.txt";
if (!file_exists($fn)) {
die("File $fn does not exist");
}
$fp = @fopen ($fn, 'a')
or die ("Cannot open $fn for append access");
// Add data to the file
fputs ($fp, "http://www.w3mentor.com/\n");
@fclose ($fp);
?>
- 上一篇:while php中while语句使用范例
- 下一篇:php 百度网盘文件直链
精彩图集
精彩文章






