|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Oct 2005
Messaggi: 407
|
[PHP]problema scrittura dati su file txt
Salve a tutti, vi illustro il mio problema, devo scrivere i dati inseriti in un form su un file txt, il tutto usando php.
Girando in rete ho travato questo esempio che riporto: Codice:
<?
$scrivi_file=fopen("pippo.txt","a+");
$stringa="messaggio di prova";
fwrite($scrivi_file,$stringa);
fclose($scrivi_file);
?>
P.S ora sto lavorando su macbook con snowleopard 10.6.4 e condivisione web è attiva....
__________________
CPU: Intel i5 750 @2.66 GHz Mainboard: ASUS P7P55D Deluxe RAM: 4x2GB Kingston HyperX 7-7-7-20 DDR3 @1333 MHz Hard Disk: Samsung SSD 840 EVO 250GB, 3 Tb WD Green caviar 64MbCache Monitor: Samsung Syncmaster P2350 FullHD Scheda Video: ASUS EAH5850 DirectCU 1Gb GDDR5 Alimentatore: Corsair HX620 80Plus Sistema Operativo: Windows 7 Professional SP1 x64 Case: Cooler Master CM 690 |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Oct 2005
Messaggi: 407
|
per la cronaca ho risolto mancava "php" nel tag di apertura
per la cronaca ho scoperto che da php 5 la scrittura su file si può fare anche con un solo comando. Codice:
<?php
//Primo metodo
$scrivi_file=fopen("pippo.txt","a+");
$stringa="messaggio di prova";
fwrite($scrivi_file,$stringa);
fclose($scrivi_file);
//Secondo Metodo disponibile da PHP 5
$file = 'people.txt';
// The new person to add to the file
$person = "John Smith\n";
// Append the contents of $person to the file named by $file.
file_put_contents($file, $person, FILE_APPEND)
?>
__________________
CPU: Intel i5 750 @2.66 GHz Mainboard: ASUS P7P55D Deluxe RAM: 4x2GB Kingston HyperX 7-7-7-20 DDR3 @1333 MHz Hard Disk: Samsung SSD 840 EVO 250GB, 3 Tb WD Green caviar 64MbCache Monitor: Samsung Syncmaster P2350 FullHD Scheda Video: ASUS EAH5850 DirectCU 1Gb GDDR5 Alimentatore: Corsair HX620 80Plus Sistema Operativo: Windows 7 Professional SP1 x64 Case: Cooler Master CM 690 |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 23:08.



















