【发布时间】:2012-07-09 08:28:10
【问题描述】:
我还需要获取img 标签信息(<img src="images/construction.jpg" border="0" alt="" />)我需要做的函数和代码修改,因为我使用的这个代码在我的foreach 循环中,因为数据是从数据库中迭代的。
我的工作代码---
<?php
$content = '<p><img src="images/construction.jpg" border="0" alt="" />This is only a testing phase data</p>';
$content = preg_replace("/<img[^>]+\>/i", "", $content);
echo $content; //OUTPUT -- This is only a testing phase data
?>
【问题讨论】:
标签: php regex string preg-replace logic