~Help!有关Session的问题:( 可能是session.save_path = 未设置好。还有就是在此之前有输出。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1、设置session.save_path = c:\temp 路径必须存在。2、session_start(); 请放在文件最前面,保证之前没有输出。3、header("location:index.php");之前也不能有输出。 本莱鸟已经照办了,还是有问题。注意我用的是IIS。程序改为:<?phpsession_cache_limiter ("nocache");session_start();session_register("stu_account","stu_pw");$db=mysql_connect("localhost","root"); mysql_select_db("dbsystem",$db); $result=mysql_query("SELECT passwd FROM student where username='$formval_username' ",$db); if ($myrow = mysql_fetch_row($result)) { if($formval_passwd==$result) { print("登录成功!!"); header("location:index.php"); mysql_free_result($result); }else{ session_destroy(); echo "密码错误,<a href=student.htm>请重新登录。</a>"; }} else{ session_destroy();echo"该用户尚未注册!,<a href=student.htm>从新登录</a>"; } ?> <html><body></body></html>出现问题如下:Warning: session_start() [function.session-start]: open(/\sess_273fd4720b3232eb2c083f70968748ec, O_RDWR) failed: Invalid argument (22) in g:\inetpub\wwwroot\system\checklogin.php on line 3Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at g:\inetpub\wwwroot\system\checklogin.php:3) in g:\inetpub\wwwroot\system\checklogin.php on line 3Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at g:\inetpub\wwwroot\system\checklogin.php:3) in g:\inetpub\wwwroot\system\checklogin.php on line 3Warning: session_destroy() [function.session-destroy]: Session object destruction failed in g:\inetpub\wwwroot\system\checklogin.php on line 22该用户尚未注册!,从新登录 回复人:sandyuk(冰の沙隆) ( 五级(中级)) 信誉:100 2003-05-13 10:53:00 得分:01、设置session.save_path = c:\temp 路径必须存在。2、session_start(); 请放在文件最前面,保证之前没有输出。3、header("location:index.php");之前也不能有输出。/edit php.ini file in */winnt/or win32 这是你的路径的问题,在php.ini里找到并改成 session.save_path = c:\temp 注意: 1.在c:盘下要建立一个temp文件夹; 2.改的那个路径前面没有“;”// 不是 ;session.save_path = c:\temp 第一种可能:在php.ini里找到并改成 session.save_path = c:\temp 注意: 1.在c:盘下要建立一个temp文件夹; 2.改的那个路径前面没有“;”// 不是 ;session.save_path = c:\temp第二种:将session_start();放在页面的最顶上去,试试!! php 语言 典范 求解 多谢了 已经会基本的PHP啦,如何学习利用面向对象的特性编写PHP 求个日期时间段查询的sql 需要长时间后台处理,会提示超出60秒错误,该如何解决? mysqldump 的使用 比較另類的問題 谁有php的网站联盟的源码啊, php能不能实现设置数据显示的方式? 为什么加了文中的代码,后面的JAVA SCRIPT就不能用了? mail函数发送内容的时候,怎样让内容被辨识为htm格式? getenv(remote_addr)无法取得访客IP地址,何解 关于页面刷新的问题
1、设置session.save_path = c:\temp 路径必须存在。
2、session_start(); 请放在文件最前面,保证之前没有输出。
3、header("location:index.php");之前也不能有输出。
程序改为:
<?php
session_cache_limiter ("nocache");
session_start();
session_register("stu_account","stu_pw");
$db=mysql_connect("localhost","root");
mysql_select_db("dbsystem",$db);
$result=mysql_query("SELECT passwd FROM student where username='$formval_username' ",$db);
if ($myrow = mysql_fetch_row($result))
{
if($formval_passwd==$result)
{ print("登录成功!!");
header("location:index.php");
mysql_free_result($result);
}
else{ session_destroy();
echo "密码错误,<a href=student.htm>请重新登录。</a>";
}
}
else
{ session_destroy();
echo"该用户尚未注册!,<a href=student.htm>从新登录</a>";
}
?>
<html>
<body>
</body>
</html>出现问题如下:
Warning: session_start() [function.session-start]: open(/\sess_273fd4720b3232eb2c083f70968748ec, O_RDWR) failed: Invalid argument (22) in g:\inetpub\wwwroot\system\checklogin.php on line 3Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at g:\inetpub\wwwroot\system\checklogin.php:3) in g:\inetpub\wwwroot\system\checklogin.php on line 3Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at g:\inetpub\wwwroot\system\checklogin.php:3) in g:\inetpub\wwwroot\system\checklogin.php on line 3Warning: session_destroy() [function.session-destroy]: Session object destruction failed in g:\inetpub\wwwroot\system\checklogin.php on line 22
该用户尚未注册!,从新登录
1、设置session.save_path = c:\temp 路径必须存在。
2、session_start(); 请放在文件最前面,保证之前没有输出。
3、header("location:index.php");之前也不能有输出。/edit php.ini file in */winnt/or win32
注意:
1.在c:盘下要建立一个temp文件夹;
2.改的那个路径前面没有“;”// 不是 ;session.save_path = c:\temp
注意:
1.在c:盘下要建立一个temp文件夹;
2.改的那个路径前面没有“;”// 不是 ;session.save_path = c:\temp第二种:
将session_start();
放在页面的最顶上去,试试!!