注意 session_register()

来源:互联网 发布:粪肉 知乎 编辑:程序博客网 时间:2024/04/19 08:25
注意

If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.

register_globals:重要提示: 自 PHP 4.2.0 开始,PHP 中的选项 register_globals 的默认值被设为 off。PHP 社区鼓励大家不要依赖于这个选项,用其它的替代,例如 superglobals

注意

This registers a global variable. If you want to register a session variable from within a function, you need to make sure to make it global using the global keyword or the $GLOBALS[] array, or use the special session arrays as noted below.

注意

If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister().