downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

yaml_emit> <Funciones de Yaml
[edit] Last updated: Thu, 23 May 2013

view this page in

yaml_emit_file

(PECL yaml >= 0.5.0)

yaml_emit_fileEnviar la representación YAML de un valor a un fichero

Descripción

bool yaml_emit_file ( string $filename , mixed $data [, int $encoding = YAML_ANY_ENCODING [, int $linebreak = YAML_ANY_BREAK [, array $callbacks ]]] )

Genera una representación YAML de data proporcionada en el filename.

Parámetros

filename

Ruta a el fichero.

data

La data se codifica. Puede ser de cualquier tipo excepto un resource.

encoding

Salida de codificación de carácteres seleccionando entre YAML_ANY_ENCODING, YAML_UTF8_ENCODING, YAML_UTF16LE_ENCODING, YAML_UTF16BE_ENCODING.

linebreak

Salida del estilo de salto de línea seleccionando entre YAML_ANY_BREAK, YAML_CR_BREAK, YAML_LN_BREAK, YAML_CRLN_BREAK.

callbacks

Manejadores de contenido para emitir nodos YAML. array asociativo de nombre de clase de asignaciones => callable. Véase emit callbacks para más detalles.

Valores devueltos

Devuelve TRUE en caso de éxito.

Historial de cambios

Versión Descripción
1.1.0 El parámetro callbacks fue añadido.

Ver también

  • yaml_emit() - Devuelve la representación de un valor YAML
  • yaml_parse() - Analiza una secuencia de texto en formato YAML



add a note add a note User Contributed Notes yaml_emit_file - [1 notes]
up
-1
M. Lamers
10 months ago
I'm getting an error with PHP version 5.3.3-7+squeeze13:
Warning: yaml_emit_file(): not yet implemented in file.php on line 1.

Not sure why, but here is a quick fix:

<?php
  $aDataToWrite
= array ( 'user' => 'test' );
 
$sYAMLdata = yaml_emit ( $aDataToWrite );

 
$fp = fopen ( 'file.yml', 'w' );
 
fwrite ( $fp, $sYAMLdata );
 
fclose ( $fp );
?>

That all, happy coding!

 
show source | credits | sitemap | contact | advertising | mirror sites