php - 使用所有可能的属性从字符串中完全删除 img 标签
问题描述
我想使用字符串中的任何属性或样式完全删除 img 标签preg_replace
$content= "image to remove completely <img src="jem.jpg" style="height:162px; width:397px" />";
这是其中的东西。
我尝试使用preg_replace
,但它没有用。
$content= "image to remove completely <img src="jem.jpg" style="height:162px; width:397px" />";
$content = preg_replace("/<img[^>]+\>/i", " ", $content );
预期输出:image to remove completely
解决方案
推荐阅读
- java - 如何在应用程序中仅在特定时间段内启用某些功能?
- php - 在移动设备上切换显示/隐藏配置 - ACF 中继器
- apache-kafka - 如果删除 Kafka 快照文件会发生什么?
- java - 我可以使用类 Timer 将日期传递给方法 scheduleAtFixedRate 吗?
- sql - SSRS 和 SQL NTILE 不接受参数?
- image - 如何在 aws s3 上浏览图像
- windows - Add-Content、Start-Transcript 和 Remove-Item 在通过任务启动时不起作用
- rest - 使“解析”函数成为 RESTful
- firebase - Firebase 云消息传递:无效的 APNs 证书
- javascript - “javascript”中的 Euler Q#2 项目