究竟错在哪?为什么整个页面都无法打开?


<?php //这段代码对未通过会员认证的人进行了跳转登录页面的处理

if($_COOKIE['userRight']!= 'normalRight'){ 
    header('location:loginPage.php');
    exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>历史测评结果展示页面</title>
</head>
<body>
<div align="center">
<table>
<tr>
<td>测评人</td>
<td>测评时间</td>
<td>测评序列</td>
</tr>
<?php
$userName=$_COOKIE['userName'];
require_once("database.php");//create the connection to database
$sql="SELECT * FROM result_table WHERE userName='$userName' ";
$result=$conn->query($sql);//we get all record in this step
$recordNumber=mysql_num_rows($result);//we get the total number of the records'rows which we need

for($i=1,$i<=$recordNumber,$i++) {
    $sql="SELECT * FROM result_table WHERE userName='$userName' and testTime=$i";
    $result=$conn->query($sql);//we get all record in this step
    $row=$result->fetch_assoc();//we get the last record 
    
    print <<<'EOF'
<tr>
<td> $userName </td>
<td> $testDate </td>
<td> $testTime </td>
</tr> 
EOF;
$conn->close();
?>
</table>
</div>
</body>
</html>

你这应该是没有打开php的调试模式,如果有语法错误是没有显示的。打开php.ini把display_error = off 改为On,否则你无法去开发。

第一,EOF定界符不需要单双引号包括,也不需要其他符号

第二,EOF结尾你的用是全角分号【;】,不是英文分号【;】,且EOF结尾需要单独一会且前面不能有任何符号以及空格

print <<<EOF
<tr>
<td> $userName </td>
<td> $testDate </td>
<td> $testTime </td>
</tr> 
EOF;

仍然不行哦,还是内部错误 500
又找了一个原因,原来for循环中是,而实际上应该用 ;