douan4106 2011-07-05 12:40
浏览 26
已采纳

Fscanf在130行PHP之后停止

I have been working on this for days, I thought I had it but was wrong.

    $done=0;
    $filename = "raw_urls.txt";
    if(! ($fhandle = fopen($filename, "r")))
    { echo "File failed to open"; 
         Exit; }
    while((fscanf($fhandle, "%s
",$url_full))!== false)
     {     
       print (mysql_error());

     if(strlen($url_full) > 3)
     {
        $url_stat++;
        $end_st = strlen($url_full)-29;
        $s_url= substr($url_full,29,$end_st);
        }
     else{
         $done++;
         }

     $res1=sql("SELECT * FROM `spy3` WHERE `Landingpage` LIKE '%$s_url%' LIMIT 0, 30 ",$o);
     if($row=mysql_fetch_array($res1))
        {
         $lp=$row[6];
         $found++;  
        }
       else{
        $nfound++;
        }


sql("insert into sitemap (url, stat_url,nf, s_recno) 
values (
'$url_full',
'$lp',
'$nfound',
'$url_stat'
)", $o);
print (mysql_error());
$found=0;
$nfound=0;
}

?>

I have tried fgets, changed txt files, it always stops between 128 and 132 lines of text. There are 2500 lines in the text file. Php.ini memory is very big. If I cut the txt file where it stops and save it, its 9k big.

  • 写回答

1条回答 默认 最新

  • dongxun6458 2011-07-05 13:01
    关注

    have seen this link..?

    Please Click here

    OR

    you can also use fseek($handle, 0); AND refer this link

    Thanks.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?