php';s问题(服务器错误)
当我键入此代码时,服务器显示“内部服务器错误”php';s问题(服务器错误),php,Php,当我键入此代码时,服务器显示“内部服务器错误” 函数行($tec,$text,$array) { 全球$html; $pos=strpos($html,$text); $len=strlen($text); $p=$pos; 对于($i=0;$iget_technology()==$tec) {if($array[$i]->get_source()==$text) $p=strpos($html,$text,(int)$p+$len); 如果($p==0或$p==false或$p==“”){re
函数行($tec,$text,$array)
{
全球$html;
$pos=strpos($html,$text);
$len=strlen($text);
$p=$pos;
对于($i=0;$iget_technology()==$tec)
{if($array[$i]->get_source()==$text)
$p=strpos($html,$text,(int)$p+$len);
如果($p==0或$p==false或$p==“”){return-1;}
}}
$pos=$p;
$result=substr($html,0,$pos);
$lineNum=substr\u计数($result,“\n”);
返回$lineNum+1;
}
有什么问题吗?
这段代码有什么问题:
,第六行
如果要添加注释,请在注释前面加上//
(//comment here
)或用/*…
*/(/*comment here*/
)将其环绕
编辑后再编辑
从语法上讲,代码很好。可能您正在调用的某个函数正在引发错误,但如果没有足够的信息,则无法判断。获取更好的错误消息(在服务器上打开调试/错误日志)。可能这两个调用中的一个没有调用方法(在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 ;
}
$array[$i]->get_Technique()
$array[$i]->get_source()