PHP 8.6.0 Beta 1 is available for testing

fdatasync

(PHP 8 >= 8.1.0)

fdatasyncSincroniza los datos (pero no los metadatos) con el fichero

Descripción

function fdatasync(resource $stream): bool

Esta función sincroniza el contenido del stream en el soporte de almacenamiento, al igual que fsync() , pero no sincroniza los metadatos de los ficheros. Cabe señalar que esta función es diferente solo en sistemas POSIX. En Windows, esta función es un alias de fsync() .

Parámetros

stream
El puntero de fichero debe ser válido y apuntar a un archivo abierto con éxito por fopen() o fsockopen() (y no cerrado aún por fclose() ).

Valores devueltos

Esta función retorna true en caso de éxito o false si ocurre un error.

Ejemplos

Ejemplo #1 Ejemplo de fdatasync()

<?php
$file = 'test.txt';
$stream = fopen($file, 'w');
fwrite($stream, 'test data');
fwrite($stream, "\r\n");
fwrite($stream, 'additional data');
fdatasync($stream);
fclose($stream);
?>

Véase también

  • fflush() - Envía todo el contenido generado en un fichero
  • fsync() - Sincroniza los cambios realizados en el fichero (incluyendo los metadatos)

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes 1 note

up
-1
greg at example dot com
3 years ago
Does not flush st_atime, st_mtime or st_size.
If you need to use filesize after a write you will need need fsync() or fflush() instead.
+add a note

AltStyle によって変換されたページ (->オリジナル) /