【发布时间】:2012-07-11 14:27:03
【问题描述】:
在我的页面中使用此代码时遇到问题:
带有过期会话的代码
<?php
session_start();
if(!isset($_SESSION['clientmacs']) ) {
header('Location: index.php');
} else {
if(time() - $_SESSION['timeLogin'] > 1800) {
header('Location: include/logout.php');
}
$userclient = $_SESSION['clientmacs'];
?>
<html>
HTML CODE
</html>
<?php
}
?>
但如果我使用此代码,问题就会消失,页面可以正常工作:
没有过期会话的代码
<?php
session_start();
if(!isset($_SESSION['clientmacs'])) {
header('Location: index.php');
} else {
$userclient = $_SESSION['client'];;
?>
<html>
HTML CODE
</html>
<?php
}
?>
谷歌浏览器出错:
This webpage has a redirect loop
Http://localhost/mac/index.php The website has too many redirects. The incidence may be
resolved by deleting the cookies from this site or allowing third party cookies. If
that fails, the incidence may be related to a bug in the server configuration, not the
computer.
【问题讨论】: