错误:警告:strpos()[function.strpos]:字符串中不包含偏移量

时间:2012-01-21 13:06:52

标签: php

显示错误:

  

警告:strpos()[function.strpos]:偏移量未包含在字符串

代码是

function trimSearchURL($URL, $Pos, $end = '&')
{
    if ($Pos) {
         $nEndPos = strpos($URL, $end, $Pos);
        if ($nEndPos === false) {
            $URL = substr($URL, $Pos);
        } else {
            $URL = substr($URL, $Pos, $nEndPos - $Pos);
        }
    }
    return $URL;
}

1 个答案:

答案 0 :(得分:3)

$ Pos似乎比$ URL中的字符串长

$nEndPos = strpos($URL, $end, $Pos)
相关问题