这个问题是怎么回事?session_start()出错

liutiejiang 2003-09-26 08:39:32
我的一个文件check.php
<?php
session_start();
$YourName=$_POST['YourName'];
$PassWord=$_POST['PassWord'];
$array = array($YourName, $PassWord);

$LoginNameAndPassWord= implode(";", $array);
$fp=fopen("sources/psw.dat","r");
$CheckOk=0;
while(!feof($fp)){
$sTitle=trim(fgets($fp,100));
if($sTitle=="LoginName&PassWord:"):
$sNP=trim(fgets($fp,200));
if($sNP==$LoginNameAndPassWord):
$CheckOk=1;
break;
endif;
endif;
}
$_SESSION['LoginOk']=$CheckOk;
if( $CheckOk==1 ):
header("Location: main.php");
else:
header("Location: index.php");
endif;
?>
LoginOk这个变量我想在main.php中间调用,但得不到。
并且还有错误:
Warning: session_start(): open(/tmp\sess_96dbce67a5bf2876922576ae37554ab6, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\htdocs\check.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\check.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\check.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\check.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\check.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\check.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\check.php on line 22

Warning: Unknown(): open(/tmp\sess_96dbce67a5bf2876922576ae37554ab6, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
清高手指点
...全文
321 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
bonniewater 2003-09-28
  • 打赏
  • 举报
回复
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\check.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\check.php on line 22



php.ini里面设置output_buffering = 4096
chlinux 2003-09-28
  • 打赏
  • 举报
回复
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

很明显了,就是路径的问题了
shuiaaa 2003-09-28
  • 打赏
  • 举报
回复
php.ini 中设置 session.save_path = c:\temp
在c盘建个文件名起为temp
jueban9818 2003-09-27
  • 打赏
  • 举报
回复
01.php
<?php
session_start();
session_register('my');
$_SESSION['my'] = "你好啊!";
?>

02.php
<?php
session_start();
session_register('my');
$my = $_SESSION["my"];
echo $my;
?>
feel8 2003-09-27
  • 打赏
  • 举报
回复
php.ini 中设置 session.save_path = c:\winnt\temp ,重启web服务器。

然后把用到header函数跳转的地方都换成echo "<script>window.location =\"$PHP_SELF\";</script>"; 这样跳转
liutiejiang 2003-09-27
  • 打赏
  • 举报
回复
各位高人:
谁能给我一段代码?只要在两个网页之间传递一个变量就行了,不要给我讲什么session了,请写出来到底怎么用,我已经试过好几次了,都不行:(
请帮帮忙吧!只要成功,另开贴子给分!急呀!
feel8 2003-09-26
  • 打赏
  • 举报
回复
有你在身旁心更坚强 兄,俺上网没事做撒,几个论坛里转悠。
:)
cnpr 2003-09-26
  • 打赏
  • 举报
回复
http://www.eaoo.com/design/list.asp?classid=2&Nclassid=9
blueoxygen 2003-09-26
  • 打赏
  • 举报
回复
session.save_path 没有配置
哈哈,早期的小鸟,你怎么总是在着泡着呢
feel8 2003-09-26
  • 打赏
  • 举报
回复
php.ini 中设置 session.save_path = c:\winnt\temp ,重启web服务器。

header之前不能有输出

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧