我收到“无法修改标头信息-标头已由...发送”警告,并且标头功能之前没有echo语句。
<?php
$error = "";
if (isset($_POST['submit'])) {
try{
$conn = new PDO(DSN,USERNAME,PASSWORD,$options);
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$email = $_POST['email'];
$password = $_POST['password'];
$loginQuery = "SELECT email,password FROM users WHERE email = :users_email AND password = :users_password";
$statement = $conn->prepare($loginQuery);
$statement->execute(array(":users_email"=>$email,":users_password"=>$password));
$result = $statement->fetchAll();
if($result){
}
else
{
header("Location: pages/signup.php");
}
}catch(PDOException $ex ){`
$error= "error occured". $ex->getMessage();
}
}