匹配一个文章里面的所有的超链接

header('Content-Type:text/html;charset=utf-8');
$string = '<a href="http://www.baidu.com">百度</a>&nbsp;<a href="http://www.sina.com.cn">新浪</a>';

$preg = '/href="(.*?)">/';
preg_match_all($preg, $string, $matches);

var_dump($matches);

 

posted on 2019-05-05 13:55  薇薇123456  阅读(151)  评论(0编辑  收藏  举报

导航