vs 代码无法识别 html 中的 php 代码

vs code not recognizing php code inside html

如您所见,我的 php 代码显示错误,无法被 vs code.My 单独的文件识别。php 文件 运行 顺利,但我无法在 html.I 内编写 php 代码,我正在使用 xampp、linux、vs 代码。

代码:

myphp.html

<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

</head>

<body>

<form method="POST" action="myphp.php">

    Name : <input type="text" name="name">

    <span class="error">* <?php echo $nameEmp; ?></span>

    <br>

    E-mail : <input type="text" name="email">

    <br>

    Link : <input type="text" name="link">

    <br>

    Comment : <textarea name="comment" rows="5" cols="40"></textarea>

    Gender :

    <input type=" radio" name="gender" value="female">Female

    <input type="radio" name="gender" value="male">male

    <br>

    <input type="submit" name="submit" value="Submit">

</form>

</body

</html>

编辑:

您为 php 编写了正确的语法,但要使 php 正常工作,您必须将文件扩展名更改为 .php 而不是 .html