如何使用所有字符串获取数组。
$str = "This is some a text with [b]Bold[/b] and [i]Italic[/i] elements inside";
preg_match_all("/.*(\[.+\]).*/isU",$str,$matches);
print_r($matches);
我只获得:
Array (
[0] => Array
(
[0] => This is a text with [b]
[1] => Bold[/b]
[2] => and [i]
[3] => Italic[/i]
)
[1] => Array
(
[0] => [b]
[1] => [/b]
[2] => [i]
[3] => [/i]
)
)
最后没有“文字内部”文字。
答案 0 :(得分:0)