array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'function.unlink.php', 1 => 'unlink', ), 'up' => array ( 0 => 'ref.filesystem.php', 1 => 'Funciones del Sistema de Archivos', ), 'prev' => array ( 0 => 'function.umask.php', 1 => 'umask', ), 'next' => array ( 0 => 'book.inotify.php', 1 => 'Inotify', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'es', 'path' => 'reference/filesystem/functions/unlink.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
unlink — Borra un fichero
Elimina filename
. Es similar a la función unlink() de C en
Unix. Se generará un error de nivel E_WARNING
si se produce
un error.
filename
Ruta del fichero.
context
Nota: Soporte para context fue añadido en PHP 5.0.0. Para una descripción de
contexts
, refiérase a Flujos.
Ejemplo #1 Uso básico de unlink()
<?php
$fh = fopen('prueba.html', 'a');
fwrite($fh, '<h1>¡Hola mundo!</h1>');
fclose($fh);
unlink('prueba.html');
?>