PHP preg_match(): Unknown modifier '/'
作者:互联网
因为/ 斜线是特殊字符需要转义/
$url = $request->get('url');
$path = dirname(APP_PATH).'/data/monitor_hosts.txt';
$b = File::someRow($path, function($host) use ($url) {
$pat = '/^http(s)?:\/\/'.$host.'.*$/';
preg_match($pat, $url, $matches);
if ($matches) {
return true;
}
return false;
});
标签:return,url,Unknown,preg,matches,pat,PHP,match 来源: https://www.cnblogs.com/lujiahao/p/15595577.html