>我需要回显html(它也包含一个变量),但我不断收到解析错误:语法错误,意外T_CONSTANT_ENCAPSED_STRING,期望'","或';'
while ($line1 = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<h1 align = "center"><strong>Section:</strong></h1>.''.'<h1align="center"><strong>$line1 ['section_id']</strong></h1>';}
基本上,我需要它来阅读部分:(然后为部分 ID 检索的任何内容,都在一行上)。在这种情况下,输出 html 的最佳方法是什么?
你的代码是火车残骸。试试这个:
while ($line1 = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<h1 align = "center"><strong>Section:</strong></h1><h1 align="center"><strong>' . $line1['section_id'] . '</strong></h1>';
}
while ($line1 = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<h1 align = "center"><strong>Section:</strong></h1><h1align="center"> <strong>' . $line1 . ' ' . ['section_id'] .'</strong></h1>';}
给你