タグ[スペース] [/ IMG] PHPである値を取得します。

ゲームイーグル:

私は値を導出する方法を教えてください123.jpgし、456.jpgその中にある[img][/img]、このラインからのタグ:

$str = "Text 1 [img]123.jpg[/img] Text 2 [img]456.jpg[/img]";
ウェズリー・スミス:

このような何かが動作します:

$re = '/\[img\](.*?\.jpg)\[\/img\]/m';
$str = 'Text 1 [img]123.jpg[/img] Text 2 [img]456.jpg[/img]';

preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);


foreach ($matches as $match) {
    if (isset($match[1])) {
        unlink($match[1]);
    }
}

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=33611&siteId=1