错误:不推荐使用:函数Session_register

时间:2012-07-19 20:48:07

标签: php function

  

可能重复:
  How to fix the session_register() DEPRECATED problem?

我最近为一个网站移动了切换主机。该网站在前端工作正常,但当我尝试登录时,我收到以下错误

Deprecated: Function session_register() is deprecated in /home/content/69/9301569/html/cls.userlogin.php on line 31

Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /home/content/69/9301569/html/cls.userlogin.php:31) in /home/content/69/9301569/html/cls.userlogin.php on line 31

Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/content/69/9301569/html/cls.userlogin.php:31) in /home/content/69/9301569/html/cls.userlogin.php on line 31

Warning: Cannot modify header information - headers already sent by (output started at /home/content/69/9301569/html/cls.userlogin.php:31) in /home/content/69/9301569/html/form-login.php on line 14

我没有建立网站;只是感动了它,所以我很失落。我该如何更正此错误?

2 个答案:

答案 0 :(得分:2)

它抱怨的行将包含这样一行:

session_register("foo");

将其替换为:

$_SESSION['foo'] = $foo;

'foo'$foo替换为正在注册的名称。

答案 1 :(得分:1)

您正在使用从新版服务器在php版本中修改的功能。 尝试使用与第一个版本相同的PHP版本在其他服务器中部署应用程序