当前位置:Gxlcms > PHP教程 > 字符串截取解决方案

字符串截取解决方案

时间:2021-07-01 10:21:17 帮助过:9人阅读

字符串截取
$subject = '
you dead!
hello
james


shit!
hi
  • list

';

$pattern = '/这里正则如何写/';
preg_match($pattern, $subject, $matches);
print_r($matches);

$pattern_1 = '/这里正则如何写/';
preg_match($pattern_1, $subject, $matches);
print_r($matches);

分别取到结果如下:
数据一:
you dead!
hello
james

数据二:
shit!
hi
  • list


请问正则要如何写才能取出上在的两个DIV中的内容呢。

分享到:


------解决方案--------------------

$subject = '
you dead!
hello
james


shit!
hi
  • list

';
preg_match_all('/]+>(([^<]*

人气教程排行