【问题标题】:Parse error: syntax error unexpected end of file in php [duplicate]解析错误:php中文件的语法错误意外结束[重复]
【发布时间】:2018-12-09 13:15:17
【问题描述】:

这是我的代码,我检查了所有右大括号和左大括号,我也没有在任何地方使用它的简短形式的 php,我不会错过';',
我不知道为什么它显示解析错误:

<html>
 <head>

  <script type="text/javascript" src="<?php echo base_url('assests/js/jquery.min.js') ?>"></script>
  <link rel="stylesheet" type="text/css" href="<?php echo base_url('assests/css/bootstrap.min.css') ?>">
  <script type="text/javascript" src="<?php echo base_url('assests/js/bootstrap.min.js') ?>"></script>
 </head>
  <body>
   <div class="container">
    <table class="hover hover-table">
       <tr>
        <th>No</th>
        <th>Code</th>
        <th>Name</th>
        <th>Address</th>
       </tr>
       <?php if(count($all_user>0))
         { $i=0;
       foreach ($all_user as $user) 
          {

           $i++;
       ?>
     <tr>
      <td><?php echo $i ?></td>
      <td><?php echo $user->code ?></td>
      <td><?php echo $user->name?></td>
      <td><?php echo $user->address ?></td>
    </tr>
         }
      }
  </table>
 </div>

  </body>
  </html>

【问题讨论】:

    标签: php html syntax-error parse-error


    【解决方案1】:

    你缺少打开和关闭php

        </tr>
        <?php } /* endforeach */
          } /* endif */ ?>
      </table>
    

    这就是您遇到错误的原因。

    【讨论】:

      【解决方案2】:

      您在花括号 &lt;?php }} 之前缺少结束 php 标记。因为你得到了Line : 36 -- syntax error, unexpected end of file

      试试这个方法,

      <html>
       <head>
        <script type="text/javascript" src="<?php echo base_url('assests/js/jquery.min.js') ?>"></script>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url('assests/css/bootstrap.min.css') ?>">
        <script type="text/javascript" src="<?php echo base_url('assests/js/bootstrap.min.js') ?>"></script>
       </head>
        <body>
         <div class="container">
          <table class="hover hover-table">
             <tr>
              <th>No</th>
              <th>Code</th>
              <th>Name</th>
              <th>Address</th>
             </tr>
             <?php if(count($all_user>0))
               { $i=0;
             foreach ($all_user as $user) 
                {
      
                 $i++;
             ?>
           <tr>
            <td><?php echo $i ?></td>
            <td><?php echo $user->code ?></td>
            <td><?php echo $user->name?></td>
            <td><?php echo $user->address ?></td>
          </tr>
             <?php
               }
             }
            ?>
        </table>
       </div>
      
        </body>
        </html>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-06-25
        • 1970-01-01
        • 2013-01-23
        • 2016-04-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多