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 (?,?,?,?,?)"; $sth = $this->db->prepare($sql); $rs = $sth->execute(array($dsid,$filename,$filesize,$isdir,$depth)); if(!$rs) { $messages[] = "数据文件".$filename.'写入失败'; } } } pg_free_result($result); pg_close($link); ?>