下载最新的php的chm手册,然手搜索session_register ,肯定可以找到满意的答案

解决方案 »

  1.   

    注意 
    If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister(). 
     
    直接用$_SESSION 好了啊
      

  2.   

    手册地址:http://cn.php.net/manual/zh/function.session-register.php
      

  3.   

    那大侠们
    我怎么使用一个session会话
      

  4.   

    <?
    session_start()
    echo session_id();//显示出seesion_ID
    ?>
      

  5.   

    php.ini=>register_globals=on
    就可以了
      

  6.   

    我的php.ini里面,找不到
    register_globals
    这一项
      

  7.   

    不对,已经是
    register_globals=on
      

  8.   

    <?php
    session_start(); $count = 0;
    $count = $_SESSION['count']; 
    $_SESSION['count']++; 
    ?>
    U have been here <?=$_SESSION['count'];?> times.
      

  9.   

    楼上的代码错误提示为
    Notice: Undefined variable: _SESSION in d:\usr\www\html\forum\test1.php on line 3Notice: Undefined variable: _SESSION in d:\usr\www\html\forum\test1.php on line 4Notice: Undefined index: count in d:\usr\www\html\forum\test1.php on line 4
      

  10.   

    楼主,用你的代码在我机器上测试没有问题,是不是你的php中的session项没配置好?
      

  11.   

    为什么
    <? session_start();?>
    <? echo "shenhu";
    session_register("count"); 
    $count++; 
    echo $count; 
    ?>
    的显示是
    shenhu1
    shenhu2
    shenhu3
    ....而<?php
    session_start();$count = 0;
    $count = $_SESSION['count']; 
    $_SESSION['count']++; 
    ?>
    U have been here <?=$_SESSION['count'];?> times.的显示始终是1谁能解释解释?
      

  12.   

    http://space9.5eo.com/bbs/showthread.php?t=42
      

  13.   

    楼主在win环境下吧?
    将php.ini的虚拟路径改为实际路径就行
    session.save_path = ./tmp
    改为
    session.save_path = c:\winnt\temp
      

  14.   

    <? session_start();?>
    <? echo "shenhu";
    session_register("count"); 
    $count++; 
    echo $count; 
    ?>
    第一个是因为你没有给count赋值,就直接用session里的值咯.
    而第二个是每次都重新赋值咯,$count = 0;所以session保存了也无效.
      

  15.   

    同意楼上的,使用session要先赋值,要不变量就不存在,另外session_start()好像要放在整个页面的第一行
      

  16.   

    session_start();if(empty($_SESSION['count'])){
       $count=0;
       $_SESSION['count']=$count;
    }$_SESSION['count']+=1;echo $_SESSION['count'];