到目前为止,这就是我所拥有的,但它似乎并没有起作用......
<?
$file = fopen('wiu.dat','r')
while (wui = fgets($file)){
if ($wui = 'True') {
header("Location: index.html");
die()
} else {
echo"<h2>Down for maintenance.</h2>"
;}}
fclose($fh);
?>
非常感谢任何反馈
答案 0 :(得分:3)
我解决了明显的问题。我在第一行之后和die()
后添加了分号,在wui
条件下将$wui
更改为while
,将$wui = 'True'
更改为$wui == 'True'
,已将fclose($fh);
更改为fclose($file);
并清理了您的缩进,以便它看起来更好。从那里开始,我想代码的成功取决于你在wiu.dat
内的内容。
<?php
$file = fopen('wiu.dat','r');
while ($wui = fgets($file)) {
if ($wui == 'True') {
header("Location: index.html");
die();
} else {
echo"<h2>Down for maintenance.</h2>";
}
}
fclose($file);
?>