2014-09-10 122 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 =[];

相關問題