在我的网页“http://www.my_web_page”中我有类似的内容:img border =“0”class =“borderx”id =“pic_15132”
我想知道我必须在preg_match_all(“”)中使用哪个参数来仅检索数字。 这是我尝试过但我的结果是:_15132
$webpage = file_get_contents("http://www.my_web_page");
preg_match_all("#_([^>]*)[0-9]{6}#", $webpage , $matches)
foreach($matches[0] as $value)
{
echo $value . "<br>";
}
谢谢,
答案 0 :(得分:1)
$webpage = file_get_contents("http://www.my_web_page");
preg_match_all("#_[^>]*([0-9]{6})#", $webpage , $matches)
foreach($matches[1] as $value)
{
echo $value . "<br>";
}