$content = '<div class="block_thumb_slide_show"><img alt="smartphone" class="aligncenter size-full">Test abc<p> <strong>Màn hình 3D</strong></p></div>';
$content = preg_replace('#<div.*?>(.*?)</div>#i', '<p>\1</p>', $content);
echo $content;
结果无法将div替换为p。如何解决
<p><img alt="smartphone" class="aligncenter size-full">Test abc<p> <strong>Màn hình 3D</strong></p></p>
答案 0 :(得分:0)
如果要将div替换为p,为什么不尝试使用:
myval.update