php通配符实现方法
时间:2021-07-01 10:21:17
帮助过:30人阅读
- $a = 'http://bbs.it-home.org/forum/viewthread.php*';
- $b = str_replace('*', '===x===', $a);
- $c = preg_quote($b);
- $d = str_replace('/', '\/', $c);
- $e = '/' . str_replace('===x===', '.+', $d) . '/is';
-
- preg_match($e, 'http://bbs.it-home.org/forum/viewthread.php?tid=12345', $m);
- print_r($m);
- ?>
|