将相对图像url替换为mysql数据库的绝对值

时间:2017-08-04 08:04:39

标签: php mysql database mysqli preg-replace

您好我从这样的数据库(joomla)获取文章

$db->setQuery("SELECT id, title, introtext, `fulltext` FROM #__content WHERE catid = 33 AND state = 1 ORDER BY ordering asc, id desc");
$json->data = $db->loadObjectList();

所以$json->data包含以下信息:

<p>example parahraph </p><img src="/images/example.jpg"><p>example paragraph</p><h1>example heading</h1>

我想在文本中找到图片(src =“”)并将/images/example.jpg替换为http://example.com/images/example.jpg

0 个答案:

没有答案