[code]
[1] text 1
[2] text 2
[3] text 3
[/code]
所以我需要这些值text 1, text 2, text 3
是数组。
我在这方面的烦恼:
$matches = preg_match_all( "/^\[\d{1,3}\](.*)/", $content, $tags );
它返回给我一个空值的数组:
Array
(
[0] => Array
(
)
[1] => Array
(
)
)
1
如何修复它或使它变好?
[code]
[1] text 1
Different content here
[2] text 2 Another dif..
[3] Also something either
to be continues!
[/code]
使用多行,它将仅返回 atext 1
而不是数组第一个元素中的所有代码
Array
(
[0] => Array
(
[0] => [1] text 1
[1] => [2] text 2 Another dif..
[2] => [3] Also something either
)
[1] => Array
(
[0] => text 1
[1] => text 2 Another dif..
[2] => Also something either
)
)
1
其他元素也将仅由第一个字符串结果。