我的php代码在PHP 7.0中可以很好地与我的网页一起工作,但是在升级到PHP 8.0之后,我的php网页不再工作了。下面是错误和警告。我不是程序员。你能帮我修理一下吗?谢谢你考虑我的请求。再次感谢。--安迪
[21-Jun-2023 23:17:27 America/New_York]
PHP Warning: Undefined variable $scrollamount in /homepages/d13xxxxx/htdocs/wish/wish.php on line 541
PHP Warning: Undefined variable $scrollamount in /homepages/d13xxxxx/htdocs/wish/wish.php on line 542
PHP Warning: Undefined variable $message in /homepages/d13xxxxx/htdocs/wish/show.php on line 11
// -- **next lines are 541 and 542**
if($scrollamount<=5){
$scrollamount=$scrollamount+1;
} else {
$scrollamount=1;
}
echo "<marquee scrollamount=$scrollamount delay=0><a href=\\"javascript:openChromeslessWindow('show.php? number=$f\[0\]','data',310,310,null,null,'查看許願內容', '#000000', '#000000', '#999988', '#808040' ,true,'??','1','#000000')\\" ONMOUSEOVER=\\"pop('來自".$f\[7\]."<br>".$f\[6\]."歲的".$f\[1\]."<br>於".$f\[2\]."<br>在這裡許了個願<br>共有".$f\[8\]."個人看過')\\"; ONMOUSEOUT=\\"kill()\\"><img src=\\"images/c".$f\[3\].".gif\\" border=0></a></marquee>";
}
}
?>
……
// ... PHP Warning: Undefined variable "$message", see below:
include "config.inc";
$f=file("database/".$_GET['number']);
for($i=0;$i<count($f);$i++){
if($i==8)$f[$i]=$f[$i]+1;
// Next line # is 11 -- PHP Warning: Undefined variable "$message"
$message=$message.$f[$i];
$ff=explode("\n",$f[$i]);
$f[$i]=$ff[0];
}
$fp=fopen("database/".$_GET['number'],"w");
flock($fp,3);
fwrite($fp,$message);
fclose($fp);`
</code>`
(Do not know how to define the variables? I knew it works in PHP 6.0 and PHP 7.0.)
1条答案
按热度按时间nnt7mjpx1#
你应该在循环之前声明变量“$scrollamount”和“$message”。例如:
}