codencode, anche dopo l'header il codice continua l'eseguzione![]()
@sharkdrew, tutte e 5 le funzioni vengono eseguite; può darsi che tu ti aspetti 5 dati su text.txt? in questo caso, le prime due funzioni salvano in text.txt, mentre le ultime 3 in rates.txt
comunque, a che serve scrivere funzioni se poi le riscrivi tutte le volte?![]()
Codice PHP:<?php
function rate($id){
$string = "clash of the olympians Voted $id!";
$f = fopen ("text.txt","a+") or die ("sorry, but the vote system is currently not working");
fwrite ($f,$string);
fclose($f);
//header('location:indexa.php'); // ociò, viene eseguito 5 volte!
}
rate(1);
rate(2);
rate(3);
rate(4);
rate(5);
header('location:indexa.php');
?>

Rispondi quotando