【发布时间】:2018-06-28 19:47:52
【问题描述】:
echo '<table class="table" cellspacing="50px">'
echo '<thead>'
echo '<tr>'
echo '<th>'FIRST NAME'</th>'
echo '<th>'LAST NAME'</th>'
echo'<th>'DEPARTMENT ID'</th>'
echo '<th>'EMAIL'</th>'
echo'</tr>'
echo'</thead>'
echo'<tbody>'
foreach ($output as $outputs){
echo '<tbody>';
echo '<tr>';
echo '<td>'. $outputs["FIRST_NAME"]."</td>";
echo '<td>'. $outputs["LAST_NAME"]."</td>";
echo '<td>'. $outputs["DEPARTMENT_ID"]."</td>";
echo '<td>'. $outputs["EMAIL"]."</td>";
echo '<tr>';
echo '</tbody>';
}
echo'</tbody>'
echo'</table>'
我的表格在 html 中工作得很好,然后我尝试将它放在 PHP 中,它在 thead 上给出了意想不到的回声。我正在寻求有关为什么我收到此错误解析错误的帮助:
语法错误,意外的 T_ECHO,需要 ',' 或 ';'
【问题讨论】:
-
;每条语句怎么样? -
考虑改变您的方法,以便在 PHP 模式之外呈现 HTML,而 PHP 仅用于动态内容。见an example here。
标签: php html-table