php正则怎么替换a标签href

php正则匹配A标签href并替换

非常简单,代码如下:

$file = "<a href="http://www.bAIdu.com">baidu</a>";
$file = preg_replace('/<a .*?href="(.*?)".*?>/is',"<a href='###'>",$file);

 

//输出结果
<a href="###">baidu</a>
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容