Ver Mensaje Individual
  #5 (permalink)  
Antiguo 19/09/2012, 05:11
r535
 
Fecha de Ingreso: mayo-2012
Mensajes: 23
Antigüedad: 14 años, 4 meses
Puntos: 4
Respuesta: Agregar texto a un archivo

Por si a alguien le sirve, lo he hecho así:

Código PHP:
// Guardar el contenido del archivo en $content
$content = file_get_contents($filename);

$file = fopen( $filename, "w+");

// Obtener la posicion de la ultima llave
$pos_key = strrpos( $content_auth ,'}');

// Reemplazar la llave final por la variable $content_add + }
$new_content = substr_replace($content, $content_add . '}', $pos_key);

fwrite($file, $new_content);
fclose($file); 
¿Alguna otra forma de hacerlo?

Saludos