嗨一个网址我想删除一个img标签与它的src在使用的preg_replace删除img标签src为使用的preg_replace
EX内容的URL。
$content = "<center><img src="http://example.net/wp-content/uploads/2012/10/cell-degeneration-contn.jpg" alt="" title="cell-degeneration-contn" width="950" height="272" class="alignnone size-full wp-image-100" /></center><h2>A first-in-class approach to stop & reverse </h2>";
所以输出会是:
$content="<center></center><h2>A first-in-class approach to stop & reverse </h2>";
,但最佳的输出是,如果可能的是:
$content="A first-in-class approach to stop & reverse ";
是否有* *使用的preg_replace? –
欢迎来到堆栈溢出。正如Marc B指出的那样,似乎正则表达式不是操作html文本的方式;只是澄清,如果你真的需要使用preg_replace – quinestor