PHP - remove

后端 未结 7 2458
梦如初夏
梦如初夏 2020-11-27 15:15

Hey, I need to delete all images from a string and I just can\'t find the right way to do it.

Here is what I tryed, but it doesn\'t work:

preg_replac         


        
相关标签:
7条回答
  • 2020-11-27 15:44

    You need to assign the result back to $content as preg_replace does not modify the original string.

    $content = preg_replace("/<img[^>]+\>/i", "(image) ", $content);
    
    0 讨论(0)
提交回复
热议问题