我有一个使用 preg_match_all 的简单 php 示例
$str = "
Line 1: This is a string
Line 2: [img] image_path [/img] Should not be [img] image_path2 [/img] included.
Line 3: End of test [img] image_path3 [/img] string.";
preg_match_all("~\[img](.+)\[/img]~i", $str, $m);
var_dump($m);
我希望它回来
array(
[0] =>image_path
[1] =>image_path2
[2] =>image_path3
)
出于某种原因,我没有得到这个结果。
蚂蚁的想法?