在PHP中自动重定向页面 [英] Redirecting a page automatically in PHP
本文介绍了在PHP中自动重定向页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在PHP中自动重定向页面
I want to redirect a page automatically in PHP
Logout.php:
Logout.php:
<?php
include "base.php";
$_SESSION = array(); session_destroy();
?>
<meta http-equiv="refresh" content="=0;URL=index.php" />
其中base.php调用数据库并启动会话:
Where base.php calls the database and starts the session:
<?php
session_start();
$dbhost = "localhost";
$dbname = "login";
$dbuser = "root";
$dbpass = "";
mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error());
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
?>
当按下注销时,我不会回到 index.php
。
When pressing logout, I am not getting back to index.php
.
推荐答案
这应该有效,你有一个额外的 =
0
:
This should work, you had an extra =
before 0
:
<meta http-equiv="refresh" content="0;URL=index.php" />
Linky https://en.wikipedia.org/wiki/Meta_refresh
这篇关于在PHP中自动重定向页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文