【发布时间】:2015-12-24 17:02:50
【问题描述】:
我必须在我的新服务器中遇到会话问题。
this link 的会话无法正常工作
我已刷新页面不显示会话,然后再次使用 Ctrl+f5 刷新页面,然后显示会话。
所以请告诉我这是服务器问题还是编码问题??
遇到编码问题而不是解决任何问题。
访问链接查看 phpinfo() :http://brahmanparivar.com/phpinfo.php
index.php 和 display.php
<?php session_start(); ?>
<html>
<head>
<title>PHP session</title>
</head>
<body>
<? if(isset( $_SESSION['name'] ) ){
echo $_SESSION['name'];
} else{
echo "not have a Session";
} ?>
<br><br>
<a href="index.php">home</a> <a href="display.php">display</a> <a href="set.php">set Session</a> <a href="logout.php">Session Out</a>
</body>
</html>
logout.php
<?php session_start(); ?>
<html>
<body>
<?php
if(isset( $_SESSION['name'] ) ){
session_destroy();
}else{
echo "not have a Session";
}
?>
<br><br>
<a href="index.php">home</a> <a href="display.php">display</a> <a href="set.php">set Session</a> <a href="logout.php">Session Out</a>
</body></html>
set.php
<?php session_start();
$_SESSION['name']="Session Set"; ?>
<html>
<head>
<title>PHP session</title>
</head>
<body>
<? if(isset( $_SESSION['name'] ) ){
echo "Set a Session :: Session Set";
} ?>
<br><br>
<a href="index.php">home</a> <a href="display.php">display</a> <a href="set.php">set Session</a> <a href="logout.php">Session Out</a>
</body>
</html>
【问题讨论】:
-
向这个问题添加代码并阐明发生了什么以及应该发生什么。
-
有一个会话问题
-
代码总是在那里,它只是一个外部链接。我复制了他的代码,并将其放在他的 OP 上,以便更好地提问,以便未来的观众不必使用外部链接。
-
@TareqMahmood 查看他的外部链接中的 URL,以获取“Session Out”链接