php新手。我遇到了错误
“解析错误:语法错误,出现意外的'mailuid'(T_STRING) /includes/login.inc.php在第7行“
当尝试按照mmtuts教程创建php登录页面时。
尝试检查缺少的分号和引号。
'
<?php
if (isset($_POST['login-submit'])) {
require 'dbh.inc.php";
$mailuid = $_POST['mailuid'];
$password = $_POST['pwd'];
if (empty($mailuid) || empty($password)) {
header("Location: ../index.php?error=emptyfields");
exit();
}
else {
$sql = "SELECT * FROM users WHERE uidUsers=? OR emailUsers=?";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("Location: ../index.php?error=sqlerror");
exit();
}
else {
mysqli_stmt_bind_param($stmt, "ss", $mailuid, $mailuid);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
if ($row = mysqli_fetch_assoc($result)) {
$pwdCheck = password_verify($password, $row['pwdUsers']);
if (pwdCheck == false) {
header("Location: ../index.php?error=wronginfo");
exit();
}
else if ($pwdCheck == true) {
session_start();
$_SESSION[userId] = $row['idUsers'];
$_SESSION[userUid] = $row['uidUsers'];
header("Location: ../index.php?login=success");
exit();
}
else {
header("Location: ../index.php?error=wronginfo");
exit();
}
}
else {
header("Location: ../index.php?error=nouser");
exit();
}
}
}
}
else {
header("Location: ../index.php");
exit();
}
'
答案 0 :(得分:0)
错误很简单,您在第7行需要dbh.inc.php的引号不匹配
将require 'dbh.inc.php";
替换为require 'dbh.inc.php';