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


I wrote this code for file handling in php,i have created href links,, but i want to pass the value of $i to the next page(rey.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 的值。

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

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