简体   繁体   中英

PHP logout link wrong

I have an icon for log out. The Problem is, when i click on the logout icon it logs me out but the design of my logout form looks different and the link is also wrong instead of index.html it links me to logout.php just after refreshing I am on the right path.

What could be my problem?

Thats on a html page, I set the link to logout.php

<li><a href="logout.php"><i class="fa fa-sign-out"></i></a></li> 

index

Thats my logout.php code

<?php
    session_start();
    session_destroy();
header("Location: index.php");
?>

logout

Syntax mistake

<?php
    session_start();
    session_destroy();
header("Location: index.php"
?>

Missing closing brackets and also maybe you need to change redirection to index.html

<?php
    session_start();
    session_destroy();
    header("Location: index.php"); // here maybe index.html depending where do you want to redirect 
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM