[Php-it] "logs/log." . date('d-m-Y H:i:s') . ".txt"

Cristiano Verondini cverondini at deis.unibo.it
Wed Dec 20 12:10:08 CET 2006


  @mkdir("logs/");
  $text = @fopen("logs/log." . date('d-m-Y H:i:s') . ".txt", "w+");
  $logs .= "Date: " . date('d-m-Y H:i:s') . $eol;
  $logs .= "To: $mail" . $eol;
  $logs .= $headers . $eol;
  $logs .= "Subject: $subject" . $eol;
  $logs .= "Message: $message" . $eol;
  fwrite($text, $logs);
  fclose($text);
    Al di la del problema specifico (direi i ':' nel nome del file), l'uso del '@' ha ovviamente causato dei problemi. Inoltre devi prevedere che la fopen() fallisca, quindi:

        $text = fopen(...);
        if ($text !== FALSE) {

            fwrite(...);
            fclose(...);
        }

-- 
Cristiano Verondini
http://www.verondini.it  ---   [ICQ: 114 190]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ziobudda.net/pipermail/php-it/attachments/20061220/56962524/attachment-0001.htm


More information about the Php-it mailing list