如何使用PHP preg_replace函数将HTML中的可点击链接转换为文本

如何使用PHP preg_replace函数将HTML中的可点击链接转换为文本,php,html,preg-replace,plaintext,Php,Html,Preg Replace,Plaintext,例如: <a href="http://www.google.com">http://www.google.com</a> 在纯文本中,不使用php中的preg_replace超链接。preg_replace(“#必须使用以下代码: preg_replace('#<a.*?>(.*?)</a>#i', '\1', $text) $content = '<a href="http://www.google.com">http://ww

例如:

<a href="http://www.google.com">http://www.google.com</a>

在纯文本中,不使用php中的preg_replace超链接。

preg_replace(“#

必须使用以下代码:

preg_replace('#<a.*?>(.*?)</a>#i', '\1', $text)
$content = '<a href="http://www.google.com">http://www.google.com</a>';
$unlinked_content = preg_replace('#<a.*?>(.*?)</a>#is', '$1', $content);
$content='';
$unlinked_content=preg_replace('#第页)

$content = '<a href="http://www.google.com">http://www.google.com</a>';
$unlinked_content = preg_replace('#<a.*?>(.*?)</a>#is', '$1', $content);