2017-07-20 122 views
-3

//这里即时尝试从数据库读取数据,但它显示分析错误:语法错误,意外结束文件在第87行的C:\ xampp \ htdocs \ primarypro \ index.php中。我检查了三次,但没有发现任何错误。请帮助寻找错误或解决这个问题,解析错误:语法错误,在C: xampp htdocs primarypro index.php文件中出现意外的结尾87行

<?php include "inc/header.php"; ?> 
<?php 
spl_autoload_register(function ($class){ 

    include"classes/".$class.".php"; 
}); 



?> 
<?php 
$user = new student(); 

?> 


<section class="mainleft"> 
<form action="" method="post"> 
<table> 
    <tr> 
     <td>Name: </td> 
     <td><input type="text" name="name" required="1"/></td>  
    </tr> 

    <tr> 
     <td>Department: </td> 
     <td><input type="text" name="name" required="1"/></td> 
    </tr> 

    <tr> 
     <td>Age: </td> 
     <td><input type="text" name="name" required="1"/></td> 
    </tr> 
    <tr> 
     <td></td> 
     <td> 
     <input type="submit" name="submit" value="Submit"/> 
     <input type="reset" value="Clear"/> 
     </td> 
    </tr> 
    </table> 
</form> 
</section> 



<section class="mainright"> 
    <table class="tblone"> 
    <tr> 
     <th>No</th> 
     <th>Name</th> 
     <th>Department</th> 
     <th>Age</th> 
     <th>Action</th> 
    </tr> 

     <?php 

     $i=0; 
     foreach($user->readAll() as $key => $value){ 
      $i++; 



    ?> 



    <tr> 
     <td><?php echo $i;?></td> 
     <td><?php echo $value['name']; ?></td> 
     <td><?php echo $value['dept']; ?></td> 
     <td><?php echo $value['age']; ?></td> 
     <td> 
     <a href="">Edit</a> || 
     <a href="">Delete</a> 
     </td> 
    </tr> 
<?php}?> 

    </table> 
</section> 

<?php include "inc/footer.php"; ?> 
+1

尝试给空间到你的卷发,''。 – chris85

+0

我不知道为什么需要使用它,我的意思是你能解释一下吗 –

+0

'<?php'不会被当作开始标签读取,因此它不会被当作PHP处理。如果其中一个答案解决了你的问题,你应该接受。 – chris85

回答

0

不太清楚这是对你的代码行87,但我认为这个问题是

<?php}?> 

这应该是

<?php } ?> 
+0

非常感谢 –

0

试试这个

<?php include "inc/header.php"; ?> 
    spl_autoload_register(function ($class){ 

    include"classes/".$class.".php"; 
}); 

$user = new student(); 

?> 


<section class="mainleft"> 
<form action="" method="post"> 
<table> 
    <tr> 
     <td>Name: </td> 
     <td><input type="text" name="name" required="1"/></td>  
    </tr> 

    <tr> 
     <td>Department: </td> 
     <td><input type="text" name="name" required="1"/></td> 
    </tr> 

    <tr> 
     <td>Age: </td> 
     <td><input type="text" name="name" required="1"/></td> 
    </tr> 
    <tr> 
     <td></td> 
     <td> 
     <input type="submit" name="submit" value="Submit"/> 
     <input type="reset" value="Clear"/> 
     </td> 
    </tr> 
    </table> 
</form> 
</section> 



<section class="mainright"> 
    <table class="tblone"> 
    <tr> 
     <th>No</th> 
     <th>Name</th> 
     <th>Department</th> 
     <th>Age</th> 
     <th>Action</th> 
    </tr> 

     <?php 

     $i=0; 
     foreach($user->readAll() as $key => $value){ 
      $i++; 



    ?> 



    <tr> 
     <td><?php echo $i;?></td> 
     <td><?php echo $value['name']; ?></td> 
     <td><?php echo $value['dept']; ?></td> 
     <td><?php echo $value['age']; ?></td> 
     <td> 
     <a href="">Edit</a> || 
     <a href="">Delete</a> 
     </td> 
    </tr> 
<?php } ?> 

    </table> 
</section> 

<?php include("inc/footer.php"); ?> 
相关问题