PHP错误地显示在网页上

时间:2017-12-07 13:43:02

标签: php html web

我有一个包含一些PHP代码的HTML文件。当我在浏览器中打开HTML文件时,所有内容都会正确显示,直到某一点。

如果您在浏览器中打开下面的HTML,您应该会看到问题。

显然,页面顶部和登录按钮下的明文php不应该像那样显示,但我无法弄清楚它为什么会这样显示。任何帮助将不胜感激。

以下是代码:

<!DOCTYPE html>
<?php
session_start();
require_once 'classes/Membership.php';
$membership = new Membership();

if ($_POST && !empty($_POST['username']) && !empty($_POST['pwd'])) {
  $membership->validate_User($_POST['username'], $_POST['pwd']);
}


  if(isset$_GET['status'] && $_GET['status'] == 'loggedout') {
$membership->log_User_Out();
}
?>

<html>
<head>
<link rel="stylesheet" type="text/css" href="default.css">
<meta http-equiv="Content-Type" content="text/html: charset=utf-8" />
<title>Login</title>
</head>
<body>
   <div id="login">
    <form class = "form-1" method="post" action ="">
  <h2>Login <small>enter your credentials</small></h2>
  <p class = "field">
    <label for = "username">Username: </label>
    <input type = "text" name = "username" />
  </p>

  <p class = "field">
    <label for = "pwd">Password: </label>
    <input type = "password" name = "pwd" />
  </p>

  <p class = "submit">
    <input type = "submit" id = "submit" value = "login" name = "submit" />
  </p>
</form>
<?php if(isset($response)) echo "<h4 class = 'alert'>" . $response . "
</h4>"?>
  </div> <!-- end login -->
</body>
</html>

0 个答案:

没有答案