1.
确定<?php之前没有任何空格或者换行2.
先调用session_start();
确定<?php之前没有任何空格或者换行2.
先调用session_start();
解决方案 »
- AJAX传递参数,PHP无法获取
- 为毛不能给类型为datetime的字段插入date("Y-m-d H:i:s"),
- 我已经从别人的网站上扫描到一堆数据,用什么方法传入我自己网站的数据库里?
- 修改数据库中内容
- phpmyadmin中文数据出现乱码
- 求助:127.0.0.1和本机ip有区别吗? 在线等!!!
- 向大家请教有关Oracle中文支持的问题,困扰我很久了
- 为什么thinkphp都没有require include引用 就可以继承 或者使用里面的东西了?
- php关于连接数据库的一些小问题,求解答
- php中如何把关键的变量写在内存中
- 用正则表达式判断一个字符出现的下限但是上限是无穷的,怎么写?
- 请教一个问题(用户效验)
session_start();//这个最好要用在你所有使用session的PHP网页的最顶部,
session_register('aaa');phpinfo();
?>
还有写入session的语句不要这样写了,关于session的新写法请查看相关资料
老的教科书过时了
下面是英文的一段描述,自己看看,如果看不懂英文就不要再写程序了,改行吧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: important note:
Since PHP 4.2.0, the default value for the PHP directive register_globals is off. The PHP community encourages all to not rely on this directive but instead use other means, such as the superglobals. Caution:
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. Caution:
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister().
2、确保被session_register的变量是全局变量
3、session_register只适用于php4.0.x