无为清净楼资源网 Design By www.qnjia.com
示例程序:test_session.php3

<?php require( "session.inc.php3");
require("cookie.inc.php3");
?>
<?php
session_checkid( 20 ); //20分钟后session失效
//下面你需要设置mysql的连接参数
mysql_connect('localhost','user','pass') or Die("can't connect to db!");  
?>  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>  
<head>
<title>Session/Cookie-测试</title>  
</head>  
<body>
<h2>This Page should show how to handle the "session.inc.php3" library</h2>
<h3>We will use a mask with a record showing routine</h3>  
<?php
if( $show ) {  
if( session_read() ) {  
$username = $session[username];  
$userpass = $session[userpass];  
echo "<P>session[username]:$username
session[userpass]:$userpass";
}
}  
else{
$session[username]="yourid";
$session[userpass]="12345";
if( !session_write() ) {  
print $sess_error;  
}else{
echo "<p>session[username]被设置成:$session[username]
" ;
echo "session[userpass]被设置成:$session[userpass]
" ;
echo "<a href='$PATH_INFO?show=1'>测试一下SESSION的作用</a>" ;
}
}
?>

</body>  
</html>   

原作者:不详  

标签:
|在P|PH|HP|P3|3中|中实|实现|现S|SE|ES|SS|SI|IO|ON|N的|的功|功能|能(|(三|三)|)|

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com