首页 > php教程 > PHP源码 > php is_file file_exists判断文件是否存函数

php is_file file_exists判断文件是否存函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
发布: 2016-06-08 17:29:26
原创
1009 人浏览过
<script>ec(2);</script>

 mysql_connect('localhost','root','root') or die('remote server cant' connect');
 mysql_select_db('www.111cn.net') or('selected not exists!');
 $sql = "Select borough_thumb,id from fke_borough where borough_thumb'' and isnew =1 ";
 $result = mysql_query( $sql ) or die(mysql_error());
 $_path ='../upfile/';
 //批量查询数据库中图片不为空的记录,并用file_exists与is_file进行图片进行分析是否存在网站指定目录
 while( $rs = mysql_fetch_array( $result ) )
 {
  $t_file = $_path.$rs['borough_thumb'];
 echo "查看";
 
 if( isFile($t_file) )
 {
  echo '存在
';
 }
 else
 {
  updateSql($rs['id']);
  echo '
',$rs['id'];
 }
 }
 //更新数据库
 function updateSql($fid)
 {
  mysql_query("Update fke_borough set borough_thumb='' where id='$fid' ") or die('update fail');
 }
 //用户判断文章是否存 is_file file_exists函数实现
 function isFile($path)
 {
  if( file_exists($path) && is_file($path))
 {
  return true;
 }
 else
 {
  return false;
 }
 }
 //注意is_file 与 file_exists函数不能判断绝对路径如我上面的$_path ='/upfile/'就会显示找不到文件,如果用../upfile/就OK了,
?>

相关标签:
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板