时间:2021-07-01 10:21:17 帮助过:4人阅读
输出
<?php
$array = array(
'abcd',
'abcde',
'bcde',
'cdef',
'defg',
'defgh'
);
$str = '~'.implode('~',$array).'~';
$word = $_GET['word']; //url = xxx.php?word=a
preg_match_all("/~({$word}(?:[^~]*))/i",$str,$matches);
var_dump($matches[1]);
//