把第2个页面的session_start(); 去掉

解决方案 »

  1.   

    $_SESSION['access']=$row[3]; 
    改为:
    $_SESSION['access']="fdsafdsa";
    试试 
      

  2.   

    ==============================================================先用这段代码看看SESSION
    //----------------a.php
    <?PHP
    Session_start();
    $_session["abc"]='ddddd';
    ?>
    <a href="c.php"> test_session </a>
    //---------------c.php
    <?php
    session_start();
    echo $_session["abc"];
    ?>
    ==============================================================
    检查PHP.INI SESSION设置
      

  3.   

    我试了一下,传了两个文件上去,但是没有显示SESSION...郁闷,
    这是A.PHP
    <?PHP 
    Session_start(); 
    $_session["abc"]='ddddd'; 
    $_session['bcd']='eee'; 
    ?> 
    <a   href="c.php">   test_session   </a> 
    <?
    echo $_session["abc"];?>
    <br><br><br><br>
    <?
    echo $_session['bcd'];
    ?>单引号和双引号都用了,可以在A.PHP里显示SESSION内容,但连接到C.PHP里就丢了..
      

  4.   

    最郁闷的不在这里,
    昨天上午,做了页面后,连接还显示 C.PHP?PHPSESSID=......现在连接就变成C.PHP了,别的都没了??我用的是虚拟主机,但能看PHP.INI
    下面是PHP.INI里关于SESSION的内容,大家帮我看一下:[Session]
    ; Handler used to store/retrieve data.
    session.save_handler = files; Argument passed to save_handler.  In the case of files, this is the path
    ; where data files are stored. Note: Windows users have to change this 
    ; variable in order to use PHP's session functions.
    session.save_path = /var/php_sessions; Whether to use cookies.
    session.use_cookies = 1; This option enables administrators to make their users invulnerable to 
    ; attacks which involve passing session ids in URLs; defaults to 0.
    ; session.use_only_cookies = 1; Name of the session (used as cookie name).
    session.name = PHPSESSID; Initialize session on request startup.
    session.auto_start = 0; Lifetime in seconds of cookie or, if 0, until browser is restarted.
    session.cookie_lifetime = 0; The path for which the cookie is valid.
    session.cookie_path = /; The domain for which the cookie is valid.
    session.cookie_domain =; Handler used to serialize data.  php is the standard serializer of PHP.
    session.serialize_handler = php; Define the probability that the 'garbage collection' process is started
    ; on every session initialization.
    ; The probability is calculated by using gc_probability/gc_divisor,
    ; e.g. 1/100 means there is a 1% chance that the GC process starts
    ; on each request.session.gc_probability = 1
    session.gc_divisor     = 1000; After this number of seconds, stored data will be seen as 'garbage' and
    ; cleaned up by the garbage collection process.
    session.gc_maxlifetime = 1440; PHP 4.2 and less have an undocumented feature/bug that allows you to
    ; to initialize a session variable in the global scope, albeit register_globals
    ; is disabled.  PHP 4.3 and later will warn you, if this feature is used.
    ; You can disable the feature and the warning seperately. At this time,
    ; the warning is only displayed, if bug_compat_42 is enabled.session.bug_compat_42 = 0
    session.bug_compat_warn = 1; Check HTTP Referer to invalidate externally stored URLs containing ids.
    ; HTTP_REFERER has to contain this substring for the session to be
    ; considered as valid.
    session.referer_check =; How many bytes to read from the file.
    session.entropy_length = 0; Specified here to create the session id.
    session.entropy_file =;session.entropy_length = 16;session.entropy_file = /dev/urandom; Set to {nocache,private,public,} to determine HTTP caching aspects.
    ; or leave this empty to avoid sending anti-caching headers.
    session.cache_limiter = nocache; Document expires after n minutes.
    session.cache_expire = 180; trans sid support is disabled by default.
    ; Use of trans sid may risk your users security.
    ; Use this option with caution.
    ; - User may send URL contains active session ID
    ;   to other person via. email/irc/etc.
    ; - URL that contains active session ID may be stored
    ;   in publically accessible computer. 
    ; - User may access your site with the same session ID
    ;   always using URL stored in browser's history or books.
    session.use_trans_sid = 1; The URL rewriter will look for URLs in a defined set of HTML tags.
    ; form/fieldset are special; if you include them here, the rewriter will
    ; add a hidden <input> field with the info which is otherwise appended
    ; to URLs.  If you want XHTML conformity, remove the form entry.
    ; Note that all valid entries require a "=", even if no value follows.
    url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
      

  5.   

    error_reporting(7)
    两个代码首行都加上看看结果!
      

  6.   

    加上了.
    a.php:
    <?PHP 
    error_reporting(7);
    Session_start(); 
    $_session["abc"]='ddddd'; 
    $_session['bcd']='eee'; 
    ?> 
    <a   href="c.php">   test_session   </a> 
    <?
    echo $_session["abc"];?>
    <br><br><br><br>
    <?
    echo $_session['bcd'];
    ?>c.php
    <?php 
    error_reporting(7);
    session_start(); 
    echo $_session["abc"]; 
    echo $_session['bcd'];
    ?> 运行后没有特别的提示啊。点A.PHP的连接进入C.PHP,还是空白页面。
      

  7.   

    a.php :改 Session_start(); 为 session_start(); // all lower case加 print_r($_SESSION); 在 a.php and c.php 看输出。
      

  8.   

    session.save_path   =   /var/php_sessions 
    有这个目录么
      

  9.   

    ---a.php:---
    <?php
    session_start();
    $_SESSION['a']="aaa";
    echo $_SESSION['a'] 
    ?>
    <p /><a href="f6.php">b.php</a>---b.php:---
    <?php 
    session_start(); 
    print_r($_SESSION); 
    ?>
      

  10.   

    session.save_path       =       /var/php_sessions   这个路径我改成
    session.save_path       =       /public_html/cgi-bin/tmp
    这个路径有.
    下面是两个程序,执行A.PHP时,显示:
    print_r: Array ( [abc] => ddddd ) 
    如果在A.PHP里加多一个SESSION也可以显示出来,但到C.PHP里就没了。a.php:
    <?PHP 
    session_start(); 
    $_SESSION["abc"]='ddddd'; 
    ?> 
    <a   href="c.php">   test_session   </a> <br><br><br>
    print_r:
    <?PHP
    print_r($_SESSION); 
    ?>c.php:
    <?PHP
    session_start();  
    ?> 
    <br>print_r:<?PHP
    print_r($_SESSION); 
    ?>
      

  11.   

    真是奇怪了,自己好了???
    现在显示一切正常??晕了。这个问题谁能给解释一下啊...哎,初学真难啊,我觉得比ASP难..