【问题标题】:unexpected (T_ENCAPSED_AND_WHITESPACE) error [duplicate]意外(T_ENCAPSED_AND_WHITESPACE)错误[重复]
【发布时间】:2017-12-29 20:46:27
【问题描述】:

在运行代码时抛出错误有人可以帮我吗

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\moduletwo\personal_view.php on line 64

代码

                <div class="table-responsive">
            <table class="table">
<tbody>
    <tr>
      <th>Sap Id :</th>
        <td><?php echo ". $row['sap_id'] .";?></td> //line 64

    </tr>
    <tr>
      <th>First Name</th>
        <td><?php echo ". $row['first_name'] .";?></td>
    </tr>

【问题讨论】:

  • 试试&lt;?php echo $row['sap_id']; ?&gt;这个。
  • 为什么你有echo ''. $row['sap_id'] .'';?你应该做&lt;?= $row['sap_id'] ?&gt;
  • 更改此行:&lt;td&gt;&lt;?php echo $row['sap_id'] ;?&gt;&lt;/td&gt;。为什么在 PHP 中需要串联?

标签: php


【解决方案1】:

您已将变量声明为字符串。 检查以下内容:

<tbody>
    <tr>
      <th>Sap Id :</th>
        <td><?php echo $row['sap_id'];?></td> //line 64

    </tr>
    <tr>
      <th>First Name</th>
        <td><?php echo $row['first_name'];?></td>
    </tr>

变量不应该在 ".." 中,字符串应该。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-05-22
    • 2013-05-14
    • 2012-03-23
    • 2015-01-09
    • 2012-01-14
    • 2017-06-20
    • 1970-01-01
    • 2020-02-07
    相关资源
    最近更新 更多