代码如下(文中调用的HTML 文件在php代码之后):
<html>
<head>
<title>Stock exchange check</title>
</head>
<body>
<h1>Amazon's stock current price</h1>
<?php$symbol='AMZN';
echo '<h1>Stock quote for'.$symbol.'</h1>';  $theurl="quotetest.html";         if (!($content=file_get_contents($theurl))) {
    echo("the url is not existed. please try later");
    exit;
}$pattern='(\\$[0-9]+\\.[0-9]+)';
echo $pattern;
$quote=array();
if (eregi($pattern,$content,$quote)) {
    echo '<p>stock last sold at:';
    echo $quote[1];
    echo '</p>';}
else {
    echo '<p> No quote available</p>';
};echo '<p>'
        .'this information retrieved from <br/>'
        ."<a href=\"$theurl\">$theurl</a><br />"
        .'on'.(date('l jS F Y g:i a T    ')).'</p>';
        
        
          echo '<p>'
       .'This information retrieved from <br />'
       ."<a href=\"$theurl\">$theurl</a><br />"
       .'on '.(date('l jS F Y g:i a T')).'</p>';
?>
</body>
</html>
以下是HTML代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>price test</h1>
<p>this $42.56is a price $26.28 test, we will list of tests</p>
<ul>
<li>$5386.235</li>
<li>$42.56</li>
<li>$65.23</li>
<li>$15.25</li>
<li>$28.23</li>
<li>$42.56</li>
<li>$45.23</li></ul>
</body>
</html>
我的问题是, 为什么eregi取出的数组$quote只有两个相同的值,但是html文件中还有很多跟pattern相同的变量,那位高手能解释一下?谢谢 :)