]+\>/i", "(image) ", $content);" method to delete the img tag That’s it."/> ]+\>/i", "(image) ", $content);" method to delete the img tag That’s it.">
Home >Backend Development >PHP Problem >How to delete img tag in php
How to delete the img tag in php: first create a PHP sample file; then use "preg_replace("/] \>/i", "(image) ", $content);" Just delete the img tag. [^>
Recommendation: "PHP Video Tutorial"
Code example:
<? $content = "this is something with an <img src=\"test.png\"/> in it."; $content = preg_replace("/<img[^>]+\>/i", "(image) ", $content); echo $content; ?>
The result is:
this is something with an (image) in it.
The above is the detailed content of How to delete img tag in php. For more information, please follow other related articles on the PHP Chinese website!