Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/10/2009, 15:45
Avatar de neodani
neodani
 
Fecha de Ingreso: marzo-2007
Mensajes: 1.811
Antigüedad: 17 años, 2 meses
Puntos: 20
Cómo imprimir salida de un array en fichero txt

Buenas,

Me pregunto como puedo escribir la salida de cualquier array, como por ej. el siguiente en un archivo TXT.

Para sacar la salida del array utilizo print_r($array). Sin embargo, si quiero pasarlo a un txt no me muestra el contenido del array

Código php:
Ver original
  1. $fp = fopen("salida.txt","a");
  2. fwrite($fp, print_r(imap_fetchstructure($imap, $message)));
  3. fclose($fp);


Código php:
Ver original
  1. stdClass Object
  2. (
  3.     [type] => 1
  4.     [encoding] => 0
  5.     [ifsubtype] => 1
  6.     [subtype] => MIXED
  7.     [ifdescription] => 0
  8.     [ifid] => 0
  9.     [ifdisposition] => 0
  10.     [ifdparameters] => 0
  11.     [ifparameters] => 1
  12.     [parameters] => Array
  13.         (
  14.             [0] => stdClass Object
  15.                 (
  16.                     [attribute] => BOUNDARY
  17.                     [value] => =_49f16ff92b161073280b5c7e7d15eca6
  18.                 )
  19.  
  20.         )
  21.  
  22.     [parts] => Array
  23.         (
  24.             [0] => stdClass Object
  25.                 (
  26.                     [type] => 0
  27.                     [encoding] => 4
  28.                     [ifsubtype] => 1
  29.                     [subtype] => PLAIN
  30.                     [ifdescription] => 0
  31.                     [ifid] => 0
  32.                     [lines] => 5
  33.                     [bytes] => 60
  34.                     [ifdisposition] => 0
  35.                     [ifdparameters] => 0
  36.                     [ifparameters] => 1
  37.                     [parameters] => Array
  38.                         (
  39.                             [0] => stdClass Object
  40.                                 (
  41.                                     [attribute] => CHARSET
  42.                                     [value] => utf-8
  43.                                 )
  44.  
  45.                         )
  46.  
  47.                 )
  48.  
  49.             [1] => stdClass Object
  50.                 (
  51.                     [type] => 5
  52.                     [encoding] => 3
  53.                     [ifsubtype] => 1
  54.                     [subtype] => PNG
  55.                     [ifdescription] => 0
  56.                     [ifid] => 0
  57.                     [bytes] => 504
  58.                     [ifdisposition] => 1
  59.                     [disposition] => ATTACHMENT
  60.                     [ifdparameters] => 1
  61.                     [dparameters] => Array
  62.                         (
  63.                             [0] => stdClass Object
  64.                                 (
  65.                                     [attribute] => FILENAME
  66.                                     [value] => color-palet.PNG
  67.                                 )
  68.  
  69.                         )
  70.  
  71.                     [ifparameters] => 1
  72.                     [parameters] => Array
  73.                         (
  74.                             [0] => stdClass Object
  75.                                 (
  76.                                     [attribute] => NAME
  77.                                     [value] => color-palet.PNG
  78.                                 )
  79.  
  80.                         )
  81.  
  82.                 )
  83.  
  84.         )
  85.  
  86. )

¿Sabéis si existe alguna forma de hacerlo?

Muchas gracias de antemano!