求助:怎么取出一段字符串中的链接

WBOY
Release: 2016-06-23 14:27:47
Original
939 people have browsed it

把下面一段字符串中的href地址取出来:

<a href="www.1.com" target="_blank">文章标题</a><a href="www.2.com" target="_blank">1-1</a> <a href="www.3.com" target="_blank">1-2</a> <a href="www.4.com" target="_blank">1-3</a>
Copy after login

需要得到这样的格式:
<i>www.1.com</i><i>www.2.com</i><i>www.3.com</i><i>www.4.com</i>
Copy after login

谢谢!


回复讨论(解决方案)

$s=<<'.implode('
  • ',$m[1]).'
  • ';
    Copy after login


    $str = '文章标题
    1-1 1-2 1-3';
    preg_match_all('',$str,$val);
    foreach($val[1] as $v){
        $newstr[]= "$v";
    }
    print_r(implode("",$newstr));

    谢谢!

    source:php.cn
    Statement of this Website
    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template