@MercanTelekom; şu örnek size yardımcı olacaktır.
<?php
$filename = "maillerim.txt"; // dosya adı.
$content = file_exists($filename) ? file_get_contents($filename) : null;
if(is_null($content))
{
exit("Dosyayı okuyamadım.");
}
$lines = explode("\n", trim($content, "\n"));
if(count($lines) <= 0)
{
exit("Dosyada hiç veri yok.");
}
if(count($lines) === 1 && strlen($lines[0]) <= 0)
{
exit("Dosyada hiç veri yok.");
}
if(isset($_GET["sil"]))
{
if(array_key_exists($_GET["sil"], $lines))
{
unset($lines[$_GET["sil"]]);
$lines = implode("\n", array_values($lines));
file_put_contents($filename, $lines);
exit("Satırı sildim.");
}
else
{
exit("Satır numarasını bulamadım.");
}
}
foreach($lines as $key => $value)
{
echo $value; // burada satır verisi
echo "<a href='?sil={$key}'>SATIRI SİL</a>";
}