file_get_contents暂时不起作用

时间:2015-10-09 14:27:35

标签: php file-get-contents

我有一个非常简单的PHP代码。它工作得很好,但如果我写了一段时间,file_get_contents不能一直工作,我需要继续刷新页面开始工作。

这是我的代码:

$counter = 0;
$counter2 = 20;
$content = file_get_contents("THEURL");
// sleep(2);

while($counter < $counter2)
{
   $counter++;
   $first_step = explode( '<h2 class="rgs">' , $content ); 
   $second_step = explode("</h2>" , $first_step[$counter] );
   // echo $second_step[0];
   $link[$counter] = htmlspecialchars($second_step[0]);
   // echo "$link";
   // echo "<br>";
} 

如果我删除了,所有工作都很好。 每个人都可以帮我解决这个问题吗?

全部谢谢!

0 个答案:

没有答案