我租了一些网站空间并上传了文件进行测试。 index.php以及包括的visitscounter.php(通过include(“ xyz”))都可以使用。我可以访问我的页面,它几乎可以完成预期的工作。如果没有以下问题:
我尝试以与visiterscounter.php相同的方式正确地包含umfrage.php和ergebnis.php-但是当我访问我的网站时,它们不会执行。甚至没有显示错误。没事。
有人知道为什么它不起作用吗?
index.php
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<span id="counter"><?php include("visitorscounter.php");?></span>
<?php include("umfrage.php");?>
<?php include("ergebnis.php");?>
</body>
</html>
umfrage.php
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action = "umfrage.php" method="post">
<input type="radio" name="result" value="0">Case1<br/>
<input type="radio" name="result" value="1">Case2<br/>
<input type="radio" name="result" value="2">Case3<br/>
<input type='submit' value="That's why!">
<?php
$datei = "result.txt";
$fp = fopen($datei,"r+");
$vote = fread($fp, filesize($datei));
$vote = explode(",", $vote);
$vote[$result]++;
$vote = $vote[0].",".$vote[1].",".$vote[2];
rewind($fp);
fputs($fp, $vote);
fclose($fp);
}
?>
</form>
</body>
</html>
ergebnis.php
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
$datei = "result.txt";
$fp = fopen($datei, "r");
$vote = fread($fp, filesize($datei));
fclose($fp);
$vote = explode(",", $vote);
$gesamt = $vote[0] + $vote[1] + $vote[2];
$laenge = 400;
$laenge0 = $vote[0] * $laenge / $gesamt;
$laenge1 = $vote[1] * $laenge / $gesamt;
$laenge2 = $vote[2] * $laenge / $gesamt;
$laenge0 = round($laenge0);
$laenge1 = round($laenge1);
$laenge2 = round($laenge2);
?>
<p>Current Number of Votes: <?php echo $gesamt; ?></p>
<table>
<tr>
<td class="vote_diagram_title">'Cause I can.</td>
<td> </td>
<td id="vote_diagram_balken1" style="width: <?php echo $laenge0;?>px;" ></td>
<td> </td>
<td> <b><?php echo $vote[0];?></b></td>
</tr>
</table>
<table>
<tr>
<td class="vote_diagram_title">'Cause I develope this page'.</td>
<td> </td>
<td id="vote_diagram_balken2" style="width: <?php echo $laenge1;?>px;" ></td>
<td> </td>
<td> <b><?php echo $vote[1];?></b></td>
</tr>
</table>
<table>
<tr>
<td class="vote_diagram_title">'Cause I smell a scent of power reloading the page.</td>
<td> </td>
<td id="vote_diagram_balken3" style="width: <?php echo $laenge2;?>px;" ></td>
<td> </td>
<td> <b><?php echo $vote[2];?></b></td>
</tr>
</table>
</body>
</html>