Home > Backend Development > PHP Tutorial > 怎么去掉html中的超链接

怎么去掉html中的超链接

WBOY
Release: 2016-06-13 10:02:47
Original
1546 people have browsed it

如何去掉html中的超链接
$a= ' 哈哈 ';
我想最后只输出 哈哈

------解决方案--------------------
http://community.csdn.net/Expert/topic/5686/5686639.xml?temp=.6129724
不写了,你自己参考一下吧。同样的题目
------解决方案--------------------
正则表达式

$a= ' 哈哈 ';

$a= preg_replace( "/ ]+> / ", " ", $a);
$a= preg_replace( "/
/ ", " ", $a);

------解决方案--------------------
$a= preg_replace( "/ ]+> / ", " ", $a);
$a= preg_replace( "/
/ ", " ", $a);

-------------------
干吗替换两遍?
$a= preg_replace( "/ ]*> / ", " ", $a);
------解决方案--------------------
-------------------
干吗替换两遍?
$a= preg_replace( "/
]*> / ", " ", $a);
-----------------------------------------------
只能去掉


应该:
$a= preg_replace( "/
]+> / ", " ", $a);
$a= preg_replace( "/ / ", " ", $a);//注意:是 "/ / ",不是 "/
/ ".

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template