刚刚接触php,看别人的源码,其中得COOKIE是通过
$HTTP_COOKIE_VARS["a"];然而这样并得不到值,为空,而改成
$_COOKIE就正常了.
是什么原因?我用的PHP是5.2版本的.方法里都包含:
global $HTTP_COOKIE_VARS
是什么意思?

解决方案 »

  1.   

    没什么区别,新老版本的差异.
    在 PHP 4.1.0 及以后版本使用$_COOKIE。之前的版本,使用 $HTTP_COOKIE_VARS。
      

  2.   

    http://www.yesky.com/imagesnew/software/php/index.html
    你可以到这里看看``
      我感觉讲的还可以``
    可以解决你的疑问
      

  3.   

    $HTTP 是为了兼容老版本的
      

  4.   

    很多函数中会定义global $HTTP_COOKIE_VARS;
    是什么意思?
    我应该如何改呢?发现如果是$HTTP_COOKIE_VARS是得不到COOKIE的,为何会这样?
    如果改为_COOKIE反而可以了.
    我该如何改?
      

  5.   

    在公共的嵌入文件中加入
    extract($_SERVER);
    其他地方都不要动
      

  6.   

    我将php.ini中的
    register_globals = On; Whether or not to register the old-style input arrays, HTTP_GET_VARS
    ; and friends.  If you're not using them, it's recommended to turn them off,
    ; for performance reasons.
    register_long_arrays = 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
    三项打开后,正常了.这样不会带来什么不好的后果吧?
      

  7.   

    PHP5的问题,COOKIE的使用和PHP4.1.0以前不同。虽然修改配置可以解决,但不建议开register_globals.
      

  8.   

    现在好像已不用,$HTTP_COOKIE_VARS["a"];
    直接用$_COOKIE
      

  9.   

    register_long_arrays = On 就开这个就可以了如果你是写新代码,就用$_cookies, 
    http_那个是为了兼容老代码
      

  10.   

    用$_cookie就行了,你不觉得#http_cookie_vars需要打太多字了吗?
      

  11.   

    php.ini里面可以开启冗余写法```不过官方推荐使用$_这样的方式````