2015-11-20 21 views
0

我想读取远程文件的某些行是代码PHP和WordPress我怎样才能读取远程文件中的某些行

    // get bio from remote servers from line 835 to 859 
       $userbio = fopen("http://example.com/".$db->username, 'r'); 
       $lineNo = 0; 
       $startLine = 865; 
       $endLine = 892; 
       while ($line = fgets($userbio)) { 
        $lineNo++; 
        if ($lineNo >= $startLine) { 
         echo $line; 
        } 
        if ($lineNo == $endLine) { 
         break; 
        } 
       } 
       fclose($userbio); 

而且在单一的PHP文件这一伟大工程,但里面的时候我得到的所有WordPress资源ID#164。 任何其他方式做这个远程阅读? 谢谢

回答

0

尝试的file_get_contents()函数,导访w3school

相关问题