2011-06-09 65 views
-3

當我鍵入此代碼,服務器將顯示「內部服務器錯誤」php的問題(服務器錯誤)

function line($tec,$text,$array) 
{ 

global $html; 

$pos= strpos($html,$text); 
$len=strlen($text); 
$p=$pos; 
for ($i = 0; $i < count($array); $i++) 
{ 

if($array[$i]->get_Technique() == $tec) 

{if($array[$i]->get_source() == $text) 
$p=strpos($html,$text,(int)$p+$len); 

if ($p===0 or $p===false or $p===""){return -1;} 

}} 

$pos=$p; 
$result=substr($html,0,$pos); 
$lineNum=substr_count($result,"\n"); 
return $lineNum+1 ; 

} 

什麼問題?

+1

[下面介紹如何查看實際的錯誤信息。](http://www.wallpaperama.com/forums/how-to-display-php-errors-in-my-script-code-when- display-errors-is-disabled-t453.html) – 2011-06-09 22:07:55

回答

1

what is the problem in this code:,第6行向下。

如果您想添加評論,請以//// comment here)爲前綴或使用/* ... * /(/* comment here */)將它們包圍。您的編輯

語法上後

編輯,代碼是好的。你打電話的一些功能可能會引發錯誤,但沒有足夠的信息就無法說清楚。獲取更好的錯誤消息(打開服務器上的調試/錯誤日誌記錄)。

+0

我認爲這只是爲了這個問題而拋出。 – Secko 2011-06-09 22:12:20

+0

@Secko:謝謝你的幫助。 – mdm 2011-06-09 22:14:25

+0

第六行下來你的意思是什麼?我沒有寫任何評論 – Elaf 2011-06-11 08:58:32

0

也許那些兩個呼叫不會調用的方法之一(這是在PHP返回一個錯誤的事情)

$array[$i]->get_Technique() 
$array[$i]->get_source() 

一個有國會,其他沒有。