从文件获取id并存储到txt

时间:2012-03-06 12:42:36

标签: php

通常我无法访问test.php源代码,但我可以查看显示id的源代码(html)。

在href代码中:http://localhost/details.php?id= 195320

在test.php中存在字母(链接):A B C D E F G H I J K L M N O P Q R S T U V W X Y Z这些对应于名称,它们的描述始终显示/分组。

  • 查看的每个字母: test.php?letter = a 此页面包含162页: test.php?letter = a& page = 1 (至162 )
  • 另一页( letter = b )包含78页,依此类推(至字母z)

甚至可以使用php get / extract id来显示这个数据,并将它们存储在.txt文件中?

1 个答案:

答案 0 :(得分:0)

我在php here

中找到了使用文件的教程

创建文件:

$ourFileName = "testFile.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);

写道:

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Bobby Bopper\n";
fwrite($fh, $stringData);
$stringData = "Tracy Tanner\n";
fwrite($fh, $stringData);
fclose($fh);

阅读:

$myFile = "testFile.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 5);
fclose($fh);
echo $theData;