gpt4 book ai didi

php - 当我注销时页面未正确重定向

转载 作者:行者123 更新时间:2023-11-29 22:20:49 25 4
gpt4 key购买 nike

<?php
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
include 'connection.php';

// session_start();

$user_check=$_SESSION['login_user'];
// SQL Query To Fetch Complete Information Of User

$ses_sql=mysqli_query($conn, "SELECT * FROM auth where email='$user_check'");
$row = mysqli_fetch_assoc($ses_sql);

$login_session =$row['email'];
$username =$row['name'];
$created_at =$row['created_at'];
$city =$row['city'];
$phone =$row['phone'];
$profile_photo =$row['photo'];

if(!isset($login_session)){
mysqli_close($conn); // Closing Connection
header('Location: index.php'); // Redirecting To Home Page
}
?>

我注释掉 session_start() 因为我已经在包含的另一个 php 文件中启动 session 。

我不明白为什么页面没有正确重定向到 index.php 文件。

最佳答案

取消注释您的 session 开始

session_start();

还要确保在开始 session 之前没有 html

关于php - 当我注销时页面未正确重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30740347/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com