PHP 页面中的会话项目错误?


a session project error in a PHP page?

代码:

<?php 
session_start();
require "connect.inc.php";                           //如果提交表单就链接数据库验证
if(isset($_POST['sub']))
{
   // 使用从表单中接收到的用户名和密码,作为在user表中的查询条件
    $stmt = $pdo->prepare("SELECT id,username FROM user WHERE username=? and userpwd=?");
    $stmt->execute(
        array($_POST["username"],md5($_POST["password"]) )
    );
    if ($stmt->rowCount()>0) 
    {
        $_SESSION=$stmt->fetch(PDO::FETCH_ASSOC);   
        // 将用户信息注册进入session
        $_SESSION["isLogin"]=1;                    
        // 注册用于判断登陆的成功的session变量
        header("Location:index.php");
    }
    else
    {
    	echo '<font color="red">用户名或密码错误</font>';
    }
    // session_destroy();
}
?>
<!DOCTYPE html>
<html>
<head>
	<title>邮件登录系统</title>
	<style>
	    div span{width:100px;text-align:right;}
	</style>
</head>
<body>
    <p>
    欢迎来到邮件系统:session ID <?php echo session_id(); ?>
    </p>
    <form action="login.php" method="post">
	 	<span>用户名:<input type="text" name="username"><br></span><br>
	 	<span>密 码:<input type="password" name="password"><br></span><br>
	 	<input type="submit" name="sub" value="登陆"></input>
    </form>
</body>
</html>
 

$stmt = $pdo->prepare("SELECT id,用户名来自用户,其中用户名=? 和用户pwd=?"); $stmt -> execute(array($_POST["username"],md5($_POST["password"]) ));

在这些行中有一个错误:语法意外$stmt,我用PDO用,不知道问题出在哪里,那种写法应该没问题吧?

洞项目在这里:https://github.com/he1986yuan/exercise.git在名为电子邮件的文档中

在这一行中:

  if(isset($_POST['sub']))
  {                                      //使用从表单中接收到的用户名和密码,作为在user表中的查询条件
// --------------------------====================

标有 = 的空格不是空格(它们是其他 utf8 字符):在我这边,我已经删除了这些字符,语法错误消失了。

 = 字符是 unicode 3000,一个表意空间。