Home  >  Article  >  Backend Development  >  PHP wildcard implementation method

PHP wildcard implementation method

WBOY
WBOYOriginal
2016-07-25 08:53:391957browse
  1. $a = 'http://bbs.it-home.org/forum/viewthread.php*';
  2. $b = str_replace('*', '===x===', $a);
  3. $c = preg_quote($b);
  4. $d = str_replace('/', '/', $c);
  5. $e = '/' . str_replace('===x===', '.+', $d) . '/is';
  6. preg_match($e, 'http://bbs.it-home.org/forum/viewthread.php?tid=12345', $m);
  7. print_r($m);
  8. ?>
复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn