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;
});
 
上一篇:preg_match用法


下一篇:preg_match_all用法