(.*?)<\/a>/is ",]."/> (.*?)<\/a>/is ",].">
Home >Backend Development >PHP Problem >How to delete a tag in php using regular method
php正则方法删除a标签的方法:使用函数【preg_replace】保留,代码为【$str = htmlspecialchars_decode($str);$str = preg_replace("/]*>(.*?)92a8f4da390e1708e8ab2a88401e00d4/is",】。
php正则方法删除a标签的方法:
目的:
使用正则表达式删除下列内容中的a标签,同时保留a标签内容
欢迎来到php中文网www.php.cn
修改后:
欢迎来到php中文网www.php.cn
解决方法:
$str = " 欢迎来到php中文网www.php.cn "; $str = htmlspecialchars_decode($str); $str = preg_replace("/]*>(.*?)<\/a>/is", "$1", $str); echo $str; 运行结果为: 1
想了解更多编程学习,敬请关注php培训栏目!
The above is the detailed content of How to delete a tag in php using regular method. For more information, please follow other related articles on the PHP Chinese website!