recursive($homedir); foreach ($files as $k=>$v) { //$pathinfo = pathinfo($path.$v); $filename = mb_substr($v,mb_strlen($homedir)+1); $filesize = filesize($v); $isdir=is_dir($v)?1:0; $depth=substr_count($filename,"/")+1; if (substr($filename,-1,1)=='/') $depth--; //$this->chmodr($path.$v,0444); $sql = "INSERT INTO datafile (dsid,filename,filesize,isdir,depth) VALUES ('$dsid','$filename','$filesize','$isdir','$depth')"; $rs = pg_query($link,$sql); if(!$rs) { $messages[] = "数据文件".$filename.'写入失败'; } } } pg_free_result($result); pg_close($link); ?>