Php Html显示不正确(将Html与变量连接起来)

Php Html显示不正确(将Html与变量连接起来),php,Php,您知道这里的错误是什么吗: $post .= " <input type='text' name='post['" . $user . "'][comment]'">"; $post.=“您正在用post后面的单引号关闭属性 $post .= " <input type='text' name='post['" . $user . "'][comment]'">"; ^

您知道这里的错误是什么吗:

  $post .= " <input type='text' name='post['" . $user . "'][comment]'">";

$post.=“您正在用
post
后面的单引号关闭属性

$post .= " <input type='text' name='post['" . $user . "'][comment]'">";
                                         ^             ^
$post.=”;
您还应该查看页面的源代码,而不是查看源代码时的开发人员控制台。开发人员控制台将更正一些HTML语法错误,但您需要查看这些错误,以了解如何调整PHP

<input type="text" name="post[1][comment]" class="form-control" required="">
$post .= " <input type='text' name='post['" . $user . "'][comment]'">";
                                         ^             ^
$post .= " <input type='text' name='post[" . $user . "][comment]'">";