Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/06/2014, 07:38
pithon
 
Fecha de Ingreso: mayo-2011
Mensajes: 1.201
Antigüedad: 13 años
Puntos: 10
Respuesta: elimnar datos de un archivo en php

Cita:
Iniciado por Italico76 Ver Mensaje
Código PHP:
Ver original
  1. $f = 'archivo.txt';
  2.  
  3. $filestr = file_get_contents($f);
  4.  
  5. $pattern = "@\[([0-9]{1,5}),[0-9]{1,5},[0-9]{1,5},(\'[a-z]{1,30}\')\]@i";
  6.  
  7. $out = preg_replace($pattern , "[$1,$2]" , $filestr);

Luego lo guardas de nuevo:

Código PHP:
Ver original 
Hola me guarda exactamente lo mismo