Home > Backend Development > PHP Tutorial > 代码贴出~希望能找出小弟我错在什么地方.多谢

代码贴出~希望能找出小弟我错在什么地方.多谢

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:13:21
Original
1019 people have browsed it

代码贴出~~~~~~~~~希望能找出我错在什么地方..谢谢
基础贴

index.php

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
 <?php session_start();
session_unset();
session_destroy();
session_register("pass");
$password=111;
$HTTP_SESSION_VARS["pass"]=$password;
echo $HTTP_SESSION_VARS["pass"];?> 
<a href="session.php">
请点击第二页面</a> 

Copy after login


session.php
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php session_start();
$i=$_SESSION['pass'];
if(isset($i))
{
    echo "成功";
    echo $i;
    }
    else
    {
        echo "失败";
        
        }

?>

Copy after login


------解决方案--------------------
去掉这三行:
session_unset(); //这是关闭 session
session_destroy(); //这也是关闭 session
session_register("pass");//这个函数已经失效了
对session赋值用
$_SESSION['pass'] = $password;
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Session
From 1970-01-01 08:00:00
0
0
0
session
From 1970-01-01 08:00:00
0
0
0
session login information
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template