我这样试过了。
代码如下:<html>
<head>
</head>
<body>
<?
$Dir = "c:\\AppServ\\php\\session\\";
$handle=opendir($Dir);
while ($file = readdir($handle)) {
if(($file<>".")&&($file<>"..")&&(filesize($Dir.$file)<>0)){
$fp = fopen($Dir.$file,"r");
$content = fread($fp,filesize($Dir.$file));
if (ereg("^t_name",$content)) {
$char[] = $content;
for ($i=0;$i<=100;$i++)
{
if ($char[$i] == $char[$i+1])
{
$temp = $char[$i+1];
$char[$i] = $temp;
}
else
{
echo $char[$i]."<br>";
echo $char[$i+1]."<br>";
}
}
}
}
?>
</body>
</html>
代码如下:<html>
<head>
</head>
<body>
<?
$Dir = "c:\\AppServ\\php\\session\\";
$handle=opendir($Dir);
while ($file = readdir($handle)) {
if(($file<>".")&&($file<>"..")&&(filesize($Dir.$file)<>0)){
$fp = fopen($Dir.$file,"r");
$content = fread($fp,filesize($Dir.$file));
if (ereg("^t_name",$content)) {
$char[] = $content;
for ($i=0;$i<=100;$i++)
{
if ($char[$i] == $char[$i+1])
{
$temp = $char[$i+1];
$char[$i] = $temp;
}
else
{
echo $char[$i]."<br>";
echo $char[$i+1]."<br>";
}
}
}
}
?>
</body>
</html>
Parse error: parse error, unexpected $end in c:\appserv\www\sky\xianshi.php on line 31