你试试看吧:
$real_dir='.';//你要打开的文件夹
if ($dir = @opendir($real_dir)) {
while (($file_name = readdir($dir)) !== false){
$path_parts = pathinfo($file_name);
if($path_parts['extension']=='.php' || $path_parts['extension']=='.net'){
$fp=fopen($file_name,'r');
$line=fgets($fp);
$line=fgets($fp);
echo "文件{$file_name}的第二行内容是:{$line}
\n";
fclose($fp);
}
closedir($dir);
}
} else echo "打开文件夹失败:$real_dir";
?>