Home >Backend Development >PHP Tutorial >如何用正则提取href、title、和span中的时间值

如何用正则提取href、title、和span中的时间值

WBOY
WBOYOriginal
2016-06-13 10:16:021615browse

怎么用正则提取href、title、和span中的时间值

  • 五大途径2011-09-21




    ------解决方案--------------------
    /
  • (.*?)(.*?)/


    ------解决方案--------------------
    preg_match('#
  • 五大途径(.*)#s',$str,$m);
    echo $m[1]; //href中的值
    echo $m[2]; //titile中的值
    echo $m[3]; //span中的值
    ------解决方案--------------------
    “/”需要转义。
    “"”也需要。
  • Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn