把session_start()放第一行去看看

解决方案 »

  1.   

    代码如:
    <?php
       Session_start();
       Session_register("mycount");
       $mycount++;
       
    ?>
    <html>
    <title>无标题文档</title>
    <body>
    <?php
       echo "$mycount";
    ?></body>
    </html>可是我就是显示不出来.请问这是为什么?
      

  2.   

    php.ini里面的session要设置正确
      

  3.   

    我的SEESION是开着的.支持SESSION的
      

  4.   

    这样试试吧~~~~~~
    <?php
       session_start();
       //实在不行。可以在这里把PHPSESSID的COOKIE手工写进去。
       $_SESSION["mycount"]++;
    ?>
    <html>
    <title>无标题文档</title>
    <body>
    <?php
       echo $_SESSION["mycount"];
    ?></body>
    </html>
      

  5.   


    ;;;;;;;;;;;;;;;;;
    ; Data Handling ;
    ;;;;;;;;;;;;;;;;;
    ;
    ; Note - track_vars is ALWAYS enabled as of PHP 4.0.3; The separator used in PHP generated URLs to separate arguments.
    ; Default is "&". 
    ;arg_separator.output = "&amp;"; List of separator(s) used by PHP to parse input URLs into variables.
    ; Default is "&". 
    ; NOTE: Every character in this directive is considered as separator!
    ;arg_separator.input = ";&"; This directive describes the order in which PHP registers GET, POST, Cookie,
    ; Environment and Built-in variables (G, P, C, E & S respectively, often
    ; referred to as EGPCS or GPC).  Registration is done from left to right, newer
    ; values override older values.
    variables_order = "EGPCS"; Whether or not to register the EGPCS variables as global variables.  You may
    ; want to turn this off if you don't want to clutter your scripts' global scope
    ; with user data.  This makes most sense when coupled with track_vars - in which
    ; case you can access all of the GPC variables through the $HTTP_*_VARS[],
    ; variables.
    ;
    ; You should do your best to write your scripts so that they do not require
    ; register_globals to be on;  Using form variables as globals can easily lead
    ; to possible security problems, if the code is not very well thought of.
    register_globals = On; This directive tells PHP whether to declare the argv&argc variables (that
    ; would contain the GET information).  If you don't use these variables, you
    ; should turn it off for increased performance.
    register_argc_argv = On; Maximum size of POST data that PHP will accept.
    post_max_size = 8M; This directive is deprecated.  Use variables_order instead.
    gpc_order = "GPC"; Magic quotes
    ;; Magic quotes for incoming GET/POST/Cookie data.
    magic_quotes_gpc = On; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
    magic_quotes_runtime = Off    ; Use Sybase-style magic quotes (escape ' with '' instead of \').
    magic_quotes_sybase = Off; Automatically add files before or after any PHP document.
    auto_prepend_file =
    auto_append_file =; As of 4.0b4, PHP always outputs a character encoding by default in
    ; the Content-type: header.  To disable sending of the charset, simply
    ; set it to be empty.
    ;
    ; PHP's built-in default is text/html
    default_mimetype = "text/html"
    ;default_charset = "gb2312"; Always populate the $HTTP_RAW_POST_DATA variable.
    ;always_populate_raw_post_data = On好象说是这里吧? 请问哪里需要改动一下的?
      

  6.   

    是不是服务器设置不允许全局变量,不能直接用变量名访问SESSION了,要$_SESSION["mycount"]才行
    也可以设置register_global为on
      

  7.   

    register_global 在我的php.ini里是设置为on的.
     mrshelly(Shelly) 给的代码我也试过了.不知道就是不能显示.很奇怪.
      

  8.   

    mrshelly(Shelly) 给的代码我也试过了,结果如下Notice: Undefined index: mycount in c:\usr\www\html\st.php on line 4

    ------------
    刷新一次之后:
    2
      

  9.   

    那你们这样试试:
    <?
    session_start();
    $_SESSION["bcount"]=3;
    echo $_SESSION["bcount"];
    ?>看看有没有值显示先。
      

  10.   

    楼主,我使用的是phpMyadmin,我的php什么都没有设置过,楼上的代码我测试过
    <?
    session_start();
    $_SESSION["bcount"]=3;
    echo $_SESSION["bcount"];
    ?>
    ---------
    输出
    3
    -----
    这次不知道我这里怎么没有提示变量没有定义。
    ------------------
    回复人: ttlingo(文弱书虫) ( ) 信誉:100  2005-04-22 17:59:00  得分: 0  
     
     
       代码如:
    <?php
       Session_start();
       Session_register("mycount");
       $mycount++;
       
    ?>
    <html>
    <title>无标题文档</title>
    <body>
    <?php
       echo "$mycount";
    ?></body>
    </html>可是我就是显示不出来.请问这是为什么?
    ====================
    我这里测试了,输出如下:
    1
    ------------刷新一次之后显示:
    2我用的是phpMyadmin,傻瓜式 
     
      

  11.   

    既然不是代码错,建议重新安装PHP环境,我用的是php4.3.10,重新装不浪费时间
      

  12.   

    已经重新安装了.
    下了个集成的php home edition