Core.php 314 B

123456789101112131415
  1. <?php
  2. namespace Spider\Lib\Doc;
  3. use Dever;
  4. class Core
  5. {
  6. public static function match($pattern, $string)
  7. {
  8. $temp = explode('||', $pattern);
  9. $index = isset($temp[1]) ? $temp[1] : 1;
  10. preg_match_all('/' . $temp[0] . '/i', $string, $match);
  11. $result = $match[$index][0];
  12. return $result;
  13. }
  14. }