我收到很多错误,更新php版本后网站无效。
[Wed Sep 10 21:47:14.094755 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Notice: Undefined variable: text in /home/**/inc/function.php on line 81
[Wed Sep 10 21:47:14.094785 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Notice: Undefined variable: text in /home/**/inc/function.php on line 81
[Wed Sep 10 21:47:14.094794 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Notice: Undefined offset: 3 in /home/**/inc/function.php on line 81
[Wed Sep 10 21:47:14.094814 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Notice: Undefined variable: text in /home/**/inc/function.php on line 81
[Wed Sep 10 21:47:14.094822 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Notice: Undefined offset: 3 in /home/**/inc/function.php on line 81
[Wed Sep 10 21:47:14.094842 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Notice: Undefined variable: text in /home/**/inc/function.php on line 81
[Wed Sep 10 21:47:14.094849 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Notice: Undefined offset: 3 in /home/**/inc/function.php on line 81
[Wed Sep 10 21:47:14.094869 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Notice: Undefined variable: text in /home/**/inc/function.php on line 81
[Wed Sep 10 21:47:14.094876 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Notice: Undefined offset: 3 in /home/**/inc/function.php on line 81
[Wed Sep 10 21:47:14.094902 2014] [:error] [pid 21347] [client 5.28.155.234:59471] PHP Fatal error: Call to undefined function session_register() in /home/**/inc/config.php on line 58
代码是:
第81行:
{
$text.=$e[$i]." ";
}
配置文件行58:
session_register("views");
答案 0 :(得分:1)
您的错误消息中只需要您所需的一切:
variable: text in /home/**/inc/function.php on line 81
这意味着以前没有设置vairalbe $text
。所以先定义变量。
第二个是不再支持session_register()
。所以更换它。
$_SESSION['views'] = 'test';
您之前遇到过这些错误,但您已停用通知。
答案 1 :(得分:0)
这不是设置在if吗?
{
$text.=$e[$i]." ";
}
如果是,并且大小写为false,则根本不会设置此变量。例如,您可以通过在脚本开头声明$text = '';
来绕过此消息。这可能不是最好的做法,但它会消除信息。
未定义偏移是指 - 没有更多代码真正难以确定的 - 没有$e[3]
之类的东西。它是在for循环中吗?如果是这样,可能是您使用$i <= something
而不是$i < something
此外,仅使用session_register&lt; PHP 5.4.0。
您可以这样做,例如
$_SESSION['username'] = $username;
答案 2 :(得分:0)
在使用$text.=$e[$i]." ";
之前,您必须定义$text
。例如,如$text ="";
或$text =[];
等