两个输出结果一样,但为啥一个判对一个判错呢

来源:3-6 查找所有匹配结果

慕码人1187127

2018-12-27 17:27

用的$pattern="/<li>(.*?)<\/li>/";都一样,输出$matches[0]和$matches[1]结果是一样的


$pattern="/<li>(.*?)<\/li>/";

preg_match_all($pattern,$str,$matches);

print_r($matches[0]);


$pattern="/<li>(.*?)<\/li>/";

preg_match_all($pattern,$str,$matches);

print_r($matches[1]);


写回答 关注

1回答

  • 慕沐9085780
    2018-12-31 13:01:09

    str中只有一个能匹配上

PHP进阶篇

轻松学习PHP中级课程,进行全面了解,用PHP快速开发网站程序

181728 学习 · 2575 问题

查看课程

相似问题