我做了一个页面,代码如下。不知道为什么,我每次刷新一遍。session就会被清空!index.php页面。不知道为什么。让我很郁闷。别人都没有这个问题。就我出现了出个问题。另外我在php里面把自动会话弄成了1也不行。最后又变回来了。!<? session_start();
$id=$_GET["id"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>主页</title>
<link href="css/black.css" rel="stylesheet" type="text/css" />
</head><body>
<? include "top.php";
include "conn/conn.php";
?>
<?
if($_SESSION["userName"]!="")
{
?>
<table width="765" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="left" class="black"><?
echo "欢迎".$_SESSION["userName"]."来到这里!";
?></td>
</tr>
</table>
<? }
else
{
include "login.php";
}
?><?
include"conn/conn.php";
$sql="select * from t_category";
$result=mysql_query($sql) or die(mysql_error());
while($info=mysql_fetch_array($result))
{
?>
<table width="765" height="150" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F3F3F3">
<tr>
<td valign="top"><table width="765" height="80" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F7F7F7">
<tr>
<td width="20%" rowspan="3" align="center" valign="top" class="black"><img src="<?=$info[pic];?>" width="120" height="90"/></td>
<td width="60%" rowspan="2" align="center" class="black"><a href="readMsg.php?category=<?=$info[category];?>"><?=$info[category];?></a></td>
<td width="20%" class="black">创建日期:<?=$info[buildDate];?></td>
</tr>
<tr>
<td width="20%" class="black">主题总数:</td>
</tr>
<tr>
<td width="60%" align="left" class="black">版主:<?=$info[master];?></td>
<td width="20%" class="black">今日主题:</td>
</tr>
</table></td>
</tr>
</table>
<?
}
?>
<? include "bottom.php";?>
</body></html>
$id=$_GET["id"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>主页</title>
<link href="css/black.css" rel="stylesheet" type="text/css" />
</head><body>
<? include "top.php";
include "conn/conn.php";
?>
<?
if($_SESSION["userName"]!="")
{
?>
<table width="765" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="left" class="black"><?
echo "欢迎".$_SESSION["userName"]."来到这里!";
?></td>
</tr>
</table>
<? }
else
{
include "login.php";
}
?><?
include"conn/conn.php";
$sql="select * from t_category";
$result=mysql_query($sql) or die(mysql_error());
while($info=mysql_fetch_array($result))
{
?>
<table width="765" height="150" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F3F3F3">
<tr>
<td valign="top"><table width="765" height="80" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F7F7F7">
<tr>
<td width="20%" rowspan="3" align="center" valign="top" class="black"><img src="<?=$info[pic];?>" width="120" height="90"/></td>
<td width="60%" rowspan="2" align="center" class="black"><a href="readMsg.php?category=<?=$info[category];?>"><?=$info[category];?></a></td>
<td width="20%" class="black">创建日期:<?=$info[buildDate];?></td>
</tr>
<tr>
<td width="20%" class="black">主题总数:</td>
</tr>
<tr>
<td width="60%" align="left" class="black">版主:<?=$info[master];?></td>
<td width="20%" class="black">今日主题:</td>
</tr>
</table></td>
</tr>
</table>
<?
}
?>
<? include "bottom.php";?>
</body></html>
我用的是IE.我在其他的机子上面也是不行! 刚刚我用了世界之窗。也8行!
就是把session 的自动变成了手动。然后又变成自动了!4楼在说的具体一点。那里的设置问题?