把php.ini中的session.auto_start改成1
解决方案 »
- 输出调用处的行数,而不是当前行数
- $_FILES["file"]["name"]是不是不能作为变量值使用?
- SQL语句该怎么写》
- 关于@fsockopen
- APACHE2.2+PHP5平台下访问PHP网页出现403错误
- Error [Xoops]: Unable to connect to database in file
- 关于php与数据库SQL的问题
- 看一个关于手机号的正则表达式问题出在哪里
- PHP到底有没有显示客户端IP的函数。
- 请教一个php的表单post数组的问题,php页面接收不到数组的值
- 关于对文件读取的内容进行分页显示的问题。求助!!
- 一个有点难度的问题;怎样用PHP实现象windows的帮助文档内的索引查询功能(输入某字符后自动显示关于该字的项目)
我把完整的代码发给大家,大家帮忙!!!!a.php
<?
@$q1 = $_POST['q1'];
if(!empty($q1))
{
$key1 = '1';
if($q1==$key1)
{
session_start();
$_SESSION['authorized'] = true;
//header('Location: register.php');
}
else
{
echo('<font color=red>wrong!!!</font>');
}
exit;
}
?>
<html>
<head>
<title>Answer my question!</title>
</head>
<body>
<form method=post action='b.php'>
<p>who's called 'donkey'?</p>
<input type=radio name=q1 value=1>1
<input type=radio name=q1 value=2>2
<input type=radio name=q1 value=3>3
<input type=radio name=q1 value=4>4
<input type=radio name=q1 value=5>5
</form>
</body>
</html>b.php
<?
if(!empty('authorized'))
{
header('Location: a.htm');
exit;
}
echo('hello,boy!!!');
?>每次都跳回a.htm!!!
如果你答错一次,,他就可以正确显示hello,boy!!!
而且
如果我将a.php的header(...)替换为:
echo('<meta http-equiv="refresh" content="0;url=register.php">');
运行正确!!!!为什么!!???这个问题郁闷我好几天了!!!!!
session_register("变量名");
如:
$authorized=true;
session_reister("authorized");b.php
<?
session_start();
if(!empty('authorized'))
{
header('Location: a.htm');
exit;
}
echo('hello,boy!!!');
?>
应该可以的.