嗨一個網址我想刪除一個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