link

Create a hard link

Syntax

link ( string $target , string $link ) : bool

Parameters

target

Target of the link.

link

The link name.

Return

Returns TRUE on success or FALSE on failure.

Examples

<?

$target = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/file.txt'; // This is the file that already exists
$link = 'link.html'; // This the filename that you want to link it to

link($target, $link);
echo readfile($link);

unlink($link);

?>
Hello5

PHP

Home Menu