當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FSS_Helper::stringStartsWith方法代碼示例

本文整理匯總了PHP中FSS_Helper::stringStartsWith方法的典型用法代碼示例。如果您正苦於以下問題:PHP FSS_Helper::stringStartsWith方法的具體用法?PHP FSS_Helper::stringStartsWith怎麽用?PHP FSS_Helper::stringStartsWith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FSS_Helper的用法示例。


在下文中一共展示了FSS_Helper::stringStartsWith方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Match

 function Match($line, $lines, $offset)
 {
     $line = trim($line);
     if ($line == "") {
         return false;
     }
     $match = false;
     // check for any starts with
     if (count($this->starts) > 0) {
         foreach ($this->starts as $starts) {
             if (FSS_Helper::stringStartsWith($line, $starts)) {
                 $match = true;
             }
         }
     }
     // check for any regular expressions
     if (count($this->regex) > 0) {
         foreach ($this->regex as $regex) {
             if (preg_match("/" . $regex . "/i", $line)) {
                 $match = true;
             }
         }
     }
     // no match found, so done
     if (!$match) {
         return false;
     }
     // have a match, if there are any nearby clauses, check them all
     if (count($this->nearby) > 0) {
         foreach ($this->nearby as $nearby) {
             // setup default lines before and after
             if (empty($nearby->lines)) {
                 $nearby->lines = 3;
             }
             if (empty($nearby->before)) {
                 $nearby->before = $nearby->lines;
             }
             if (empty($nearby->after)) {
                 $nearby->after = $nearby->lines;
             }
             // if there is a regex in the nearby, check it
             if (isset($nearby->regex)) {
                 // create new match class
                 $test = new TrimMatch();
                 $test->regex[] = $nearby->regex;
                 // work out which lines
                 $start = max(0, $offset - $nearby->before);
                 $end = min(count($lines) - 1, $offset + $nearby->after);
                 $found = false;
                 // check each line
                 for ($i = $start; $i <= $end; $i++) {
                     $subline = trim($lines[$i]);
                     if ($test->Match($subline, $lines, $i)) {
                         $found = true;
                         break;
                     }
                 }
                 // if its not found, we failed for this line
                 if (!$found) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
開發者ID:vstorm83,項目名稱:propertease,代碼行數:66,代碼來源:emailcheck.php


注:本文中的FSS_Helper::stringStartsWith方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。