2014-09-10 119 views
0

更新php版本后,出现许多错误,并且网站无法正常工作。更新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

它不是说它就在那里“调用未定义的函数session_register()在/home/**/inc/config.php第58行”? – kkuilla 2014-09-10 10:46:15

回答

1

有你在你的错误消息需要:

variable: text in /home/**/inc/function.php on line 81 

这意味着以前没有设置价格$text。所以之前定义变量。第二个是session_register()不再支持。所以替换它。

$_SESSION['views'] = 'test'; 

您之前有错误,但是您已禁用了通知。

+0

我尝试在之前定义文本变量,但它不起作用... – 2014-09-10 10:50:17

+0

你如何做到这一点? – Stony 2014-09-10 10:50:52

+0

$ text ='';不工作... – 2014-09-10 10:51:50

0

是不是这里面设置了if?

{ 
    $text.=$e[$i]." "; 
} 

如果是,并且情况将是错误的,那么这个变量将不会被设置。例如,您可以通过在脚本开头声明它为$text = '';来绕过此消息。这可能不是最好的做法,但它会消除信息。

未定义的偏移量指的是 - 没有更多的代码真的很难确定 - 没有$e[3]这样的东西。它是否在for循环?如果是这样,可能是问题,你正在使用$i <= something,而不是$i < something

另外,session_register仅用于< PHP 5.4.0。

例如,您可以

$_SESSION['username'] = $username; 
+0

有没有解决方案可以在php 5.3中添加顶级代码和所有工作? – 2014-09-10 10:59:44

+0

是否可以将整个PHP文件发布? – 2014-09-10 11:01:16

+0

这是很多文件...这是问题... – 2014-09-10 11:02:06

0

做到这一点使用$text.=$e[$i]." ";,你必须定义$text之前。例如像$text ="";$text =[];

相关问题