2011-04-13 11 views

Respuesta

8
$handle = fopen ("/path/to/file.txt", "w+"); 
fclose($handle); 

eche un vistazo a documentation para obtener más información.

10

PHP's file_put_contents() debería ser útil en este caso. Aquí hay un código de ejemplo:

file_put_contents('myfile.txt', ''); 
+1

Usted tiene sus parámetros al revés ... –

+0

@ Chris - fijo para @Robik – Treffynnon

+0

@Treggynnon Gracias. @Chris gracias por la información – Robik

4
<?php 
file_put_contents("myfile.txt", ""); 
?> 
2
$file = fopen('myfile.txt', 'w'); 
fclose($file); 
0
$handle = fopen("myfile.txt", "w+"); 
fwrite($handle , ''); 
fclose($handle); 
0
$myFile = "myFile.txt"; 
$fh = fopen($myFile, 'w') or die("can't open file"); 
fwrite($fh, ""); 
fclose($fh); 
Cuestiones relacionadas