<?php$txt = "<log>abc</log>";
preg_match('/<log>.*?</log>/', $txt, $matches);?>运行后报错: Warning: preg_match() [function.preg-match]: Unknown modifier 'l' in test.php为什么呢?

解决方案 »

  1.   

    $txt = "<log>abc</log>";
    preg_match('/<log>.*?<\/log>/', $txt, $matches);/ 这个要转义
      

  2.   

    谢谢ls,可以了,但是,我改成这样后<?php$txt = "<log>abc</log>";
    preg_match('/<log>.*?<\/log>/', $txt, $matches);echo $matches[0];?>为什么不是 <log>abc</log> 而是 abc 呢?
      

  3.   

    是<log>abc</log> 你右键查看源代码就知道了  <log>被浏览器解析了
      

  4.   

    如果你在浏览器输出,要查看网页源码,才能看到<…>