当我键入此代码时,服务器显示"内部服务器错误"
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 ;
}
怎么了?
what is the problem in this code:
,第6行向下。
如果要添加注释,请在其前面加上//
(// comment here
)或在其周围加上/* ...
*/(/* comment here */
)。
编辑后编辑
从语法上讲,代码很好。您正在调用的某个函数可能会引发错误,但如果没有足够的信息,则无法判断。获得更好的错误消息(在服务器上打开调试/错误日志记录)。
也许这两个调用中的一个没有调用方法(这会在php中返回错误)
$array[$i]->get_Technique()
$array[$i]->get_source()
一个有国会大厦,另一个没有。