利用正则表达式来匹配html中a标签中的内容:
获取html内容:
$contents = file_get_contents('a.html');
利用正则匹配:
preg_match_all('/<a.*>(.*)<\/a>/',$contents,$matches);
输出:
print_r($matches[1]);
利用正则表达式来匹配html中a标签中的内容:
获取html内容:
$contents = file_get_contents('a.html');
利用正则匹配:
preg_match_all('/<a.*>(.*)<\/a>/',$contents,$matches);
输出:
print_r($matches[1]);