php利用preg_match_all()正则获取字符串中指定参数链接地址

作者:袖梨 2022-06-25

程序代码

 $html = <<   a1
  a2
HTML;

 // echo $html;

$m = array();
preg_match_all("|(.*?)|",$html,$m);

print_r($m);

运行结果

Array
(
    [0] => Array
        (
            [0] => a1
            [1] => a2
        )

    [1] => Array
        (
            [0] => 2008
            [1] => 2009
        )

    [2] => Array
        (
            [0] => a1
            [1] => a2
        )

)

相关文章

精彩推荐