帮忙改错PHP Warning: Invalid argument supplied for foreach() in
{echo"<palign='center'>DX聊天室提示<hr><p>";echo"<palign='center'>权限不够,不能进入本页面!";echo"<pal...
{
echo "<p align='center'>DX聊天室提示<hr><p>";
echo "<p align='center'>权限不够,不能进入本页面!";
echo "<p align='center'><a href='index.php'>请登录</a>";
echo "<p align='center'><a href='chat.php?login=yk'>或以[游客]身份登陆</a>";
}
else
{
$flag = 0;
$r = 0;
$online = "online.txt";
$online_array = file($onfile);
foreach ($online_array as $user_on)
{
$r = $r+1;
$oneuser = explode("&&",$user_on);
if($chatname == $oneuser[0])
{
$flag = 1;
$delline=$r;
$farray=file($onfile);
for($i=0;$i<count($farray);$i++)
{
if(($i+1) == $delline)
{
continue;
}
elseif(trim($farray[$i])<>"")
{
$newfp.=$farray[$i];
}
}
$fp=@fopen($onfile,"w");
@fputs($fp,$newfp);
@fclose($fp);
}
} 展开
echo "<p align='center'>DX聊天室提示<hr><p>";
echo "<p align='center'>权限不够,不能进入本页面!";
echo "<p align='center'><a href='index.php'>请登录</a>";
echo "<p align='center'><a href='chat.php?login=yk'>或以[游客]身份登陆</a>";
}
else
{
$flag = 0;
$r = 0;
$online = "online.txt";
$online_array = file($onfile);
foreach ($online_array as $user_on)
{
$r = $r+1;
$oneuser = explode("&&",$user_on);
if($chatname == $oneuser[0])
{
$flag = 1;
$delline=$r;
$farray=file($onfile);
for($i=0;$i<count($farray);$i++)
{
if(($i+1) == $delline)
{
continue;
}
elseif(trim($farray[$i])<>"")
{
$newfp.=$farray[$i];
}
}
$fp=@fopen($onfile,"w");
@fputs($fp,$newfp);
@fclose($fp);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询