正则去掉<a>标签并保留标签内容

话不多说,直接上例子:

1
2
3
4
$str "<a href=http://www.ldsun.com/ target="blank"> www.ldsun.com </a>";  
$str1 = preg_replace("/<a[^>]*>/",""$str);
$str2 = preg_replace("/<\/a>/",""$str1);
echo $str2;
Author

Ludis

Posted on

2014-05-27

Updated on

2014-05-27

Licensed under

Comments