代码如下:
<?php
$con=mysql_connect("localhost","aaaa","bbbb");
mysql_select_db("aaaa");
$sql="select user_name from member";
$rows=array();
$rows=mysql_query($sql,$con);
while($row=mysql_fetch_array($rows))
{
$url="http://t.78123.conn.in/user_xx1.php?un=".$row[0];
        $file=file_get_contents($url);
        eregi('<span class="more" id="xjhy">\((.*)\)</span> </legend><label><fieldset',$file,$sj);
$userdj=$sj[1];
if ($userdj=="" )
$userdj=0;
echo "用户名:".$row[0]."-数量:".$userdj."-URL:".$url."<br>";

}?>
演示:http://t.78123.conn.in/36.php
列表中的数量是不对的,有的用户明明是0,读出来却成了别的数。
例如最后一条
"用户名:visptar33a-数量:17-URL:http://t.78123.conn.in/user_xx1.php?un=visptar33a"
浏览这个url会发现其余他的数量是0,读取出来却显示是17
http://t.78123.conn.in/user_xx1.php?un=visptar33a
这是为什么呢,请指教。

解决方案 »

  1.   

    eregi('<span class="more" id="xjhy">\((.*?)\)</span> </legend><label><fieldset',$file,$sj);
      

  2.   

    while($row=mysql_fetch_array($rows))
    {
            $url="http://t.78123.conn.in/user_xx1.php?un=".$row[0];
            $file=file_get_contents($url);
            if(!empty($file)){
                break;
            }    
    }
      eregi('<span class="more" id="xjhy">\((.*)\)</span> </legend><label><fieldset',$file,$sj);
            $userdj=$sj[1];
            if ($userdj=="" )
            $userdj=0;
            echo "用户名:".$row[0]."-数量:".$userdj."-URL:".$url."<br>";