我想搜索我拥有的字符串,并提取出可能以.com.net等结尾的域名…
$string = "Just head over to nba.com";
$string = "visit cnn.net";
请帮我把上面的域名提取到一个变量中。
提前谢谢。
if (preg_match_all('/'w+'.(com|net)/', $text, $matches)){
print_r($matches);
}
第一场比赛将是:
echo $matches[0][0];
我想搜索我拥有的字符串,并提取出可能以.com.net等结尾的域名…
$string = "Just head over to nba.com";
$string = "visit cnn.net";
请帮我把上面的域名提取到一个变量中。
提前谢谢。
if (preg_match_all('/'w+'.(com|net)/', $text, $matches)){
print_r($matches);
}
第一场比赛将是:
echo $matches[0][0];