is_link

(PHP 4, PHP 5, PHP 7)
Tells whether the filename is a symbolic link
bool is_link ( string $filename )

Tells whether the given file is a symbolic link.

Parameters:
filename

Path to the file.

Returns:

Returns TRUE if the filename exists and is a symbolic link, FALSE otherwise.

Exception:

Upon failure, an E_WARNING is emitted.

Notes:
The results of this function are cached. See clearstatcache() for more details.
Examples:
Create and confirm if a file is a symbolic link
<?php
$link = 'uploads';

if (is_link($link)) {
    echo(readlink($link));
} else {
    symlink('uploads.php', $link);
}
?>

See also:

is_dir() -

is_file() -

readlink() -

doc_php
2016-02-24 15:56:54
Comments
Leave a Comment

Please login to continue.