我在php中编写了这个代码用于文件处理,我创建了href链接,但我想将$ i的值传递给下一页(rey.php))

时间:2015-03-14 10:17:30

标签: php

$myfile = fopen("Cadence_html.txt", "r") or die("Unable to open file!");
$i = 0;
while(!feof($myfile))  {    
    $a=fgets($myfile);

    if(   (strpos($a, 'User') === false) 
       && (strpos($a, '***') === false) 
       && (strpos($a, '!!!') === false) 
       && (strpos($a, 'RESERVATION') === false) ) {

        $i = $i + 1;
        echo '<a href="rey.php">**Kill**_____</a>';
    }
    if(strpos($a, '!!!') !== false) {
        echo '<br>';
    } else {
        echo $a.'<br>';
    }
}
fclose($myfile);`

这里$ i在每次迭代时递增,因此**Kill**链接在循环中形成。 我需要为相应的**Kill**链接传递$ i的值。

1 个答案:

答案 0 :(得分:0)

我不确定这是不是你的意思?

                    $i++;
                    echo'<a href="rey.php?i='.$i.'">**Kill**_____</a>';
                    }