You can use $str = preg_replace("/]*href=[^>]*>|[^a]*a[^>]*>/ i","",$strhtml); This paragraph is used to implement the requirements. If you want more solutions, you can refer to the following.
1. Delete the hyperlink in the content
Copy the code The code is as follows:
ereg_replace ('
]*)>([^<]*)','
\2',$ content);
ereg_replace("
]*>|","",$content);
2. Eliminate hyperlinks containing specific words
Copy code The code is as follows:
$find="this string is my find";
$string='
replaced';//replace the hyperlink with content
echo ereg_replace('
]*)>([^<]*'.$find.'[^>]*)','
\2',$content);
3. Get the hyperlink text content
Copy the code The code is as follows:
// Method 1
preg_match_all('/<(a|a)[s]{0,1}[w=":()]*>[nrn]*(check user)[nrn]* (a|a)>/i',$string,$matches);
//Method 2
preg_match_all('/check user/i',$string,$matches);
print_r($matches);
//Method 3
preg_match_all('/]*>[^<]*/i',$string,$matches);
print_r($matches);
//Method 4
preg_match_all('/check user/is',$str,$arr);
print_r($arr);
//Method 5
preg_match_all('/check user/is',$str,$arr);
print_r($arr);
http://www.bkjia.com/PHPjc/825106.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825106.htmlTechArticleYou can use $str = preg_replace("/a[^]*href=[^]*|/[^ a]*a[^]*/i","",$strhtml); This paragraph is used to implement the requirements. If you want more solutions, you can refer to the following. 1. Delete super...