代码之家  ›  专栏  ›  技术社区  ›  user3325477

分析错误:语法错误,第44行/home/comp3170-020/public_html/assignment1/index.php中出现意外的T_ENDIF

  •  -2
  • user3325477  · 技术社区  · 11 年前
         <?php
        if (!empty($_SESSION['err'])): ?>
        <tr>
          <td width="220" class="content_l" > <font color = "ff0000"> 
           <?php foreach ($_SESSION['err'] as $err): echo $err.'<br>';  ?> </td>
         </tr>
         <?php
         endif;
         unset($_SESSION['err'];
         ?>
    

    继续犯这个错误,看不出任何错误。

    1 回复  |  直到 11 年前
        1
  •  0
  •   Karim Lahlou    11 年前

    应该是这样的:

       <?php
    if (!empty($_SESSION['err'])):
    ?>
    <tr>
      <td width="220" class="content_l" > <font color = "ff0000"> 
    
       <?php foreach ($_SESSION['err'] as $err){ echo $err.'<br>'; }?> </td>
    
     </tr>
    
     <?php
     endif;
     unset($_SESSION['err']);
     ?>