<p><img width="15" height="24" alt="" src="/images/xinyu126/image/open.png" /></p> <p>&nbsp;</p> img标签提取src的值。注意。这个只是一个字符串。3Q

解决方案 »

  1.   

    $str = <<<EOF
    <p> <img width="15" height="24" alt="" src="/images/xinyu126/image/open.png" /> </p> <p>&nbsp; </p>
    EOF;
    preg_match_all('|src="([^"]+)"|iSU', $str, $out);
    echo $out[1][0];
      

  2.   

    output:/images/xinyu126/image/open.png
      

  3.   


    preg_match('/(?<=src=").*(?=")/',$str,$output);
    print_r($output);