卡在file_get_contents

用户名

伙计们。请帮助我找出问题所在。我的ftvgirlsbay.com网站上有一个脚本:

    <?php
    define('C', 16); // NUMBER OF ROWS
    define('D', 6); // NUMBER OF CELLS

    $file = @file_get_contents('http://ftvgirlsbay.com/design/tables/gals.txt');
    if($file === FALSE) { 
        echo "<h2>Make file gals.txt with data!</h2>";
        return FALSE; 
    }
    $file = explode("\r\n", $file);
    $thumbs = array();
    while(list(,$el) = each($file)) {
        $el = explode('|', $el);
        if(isset($el[0]) && isset($el[1]))
            $thumbs[] = array($el[0], $el[1]);
    }
    //print_r($thumbs);
    $size = sizeof($thumbs);
    if($size < C*D) {
         echo "<h2>More data needed. You have $size, you need ".C*D."!</h2>";
         return FALSE;
    }

    $range = range(0, $size - 1);
    shuffle($range);
    //print_r($range);
?>
<table align=center>
<?php
    $num = 0;
    for($i = 0; $i < C; $i++) {
        echo '<tr align=center>'."\r\n";
        for($k = 0; $k < D; $k++) {
            echo '<td><a href="'.$thumbs[$range[$num]][1].'">FTV '.$thumbs[$range[$num]][0].' Gallery</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>'."\r\n";
            $num++;
        }
        echo '</tr>'."\r\n";
    }
?>
</table>

该脚本的结果是:“需要更多数据。您有1,您需要96!” http://ftvgirlsbay.com/random_scripts/test.php

如果这部分

$file = @file_get_contents('http://ftvgirlsbay.com/design/tables/gals.txt');

改成

$file = @file_get_contents('http://sexsticker.info/ftvgirlsbay.com/pictable/gals.txt');

它很好用

http://ftvgirlsbay.com/random_scripts/test2.php

因此,如果我链接到服务器辅助脚本上的.txt文件,则该行仅读取1行。如果我链接到远程服务器上的.txt,脚本将在所有行中正常工作

放克四十尼纳

我发现了您的问题,并能够复制该问题。

问题出\r

$file = explode("\r\n", $file);

除掉 \r

$file = explode("\n", $file);

两台服务器可能不同。一个可能在Linux上,而另一个可能在Windows服务器上。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章