link

(PHP 4, PHP 5, PHP 7, PHP 8)

link建立一個硬連接

說明

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

link() 建立一個硬連接。

參數(shù)

target

要鏈接的目標(biāo)。

link

鏈接的名稱。

返回值

成功時返回 true, 或者在失敗時返回 false。

注釋

注意: Windows下:該功能需要以 elevated 模式運行,或者關(guān)閉 UAC。

更新日志

版本 說明
5.3.0 該功能在 Windows 平臺下開始有效(Vista、 Server 2008 或更高版本)。

范例

示例 #1 Creating a simple hard link

<?php
$target 
'source.ext'// This is the file that already exists
$link 'newfile.ext'// This the filename that you want to link it to

link($target$link);
?>

注釋

注意: 此函數(shù)不能作用于遠(yuǎn)程文件,被檢查的文件必須是可通過服務(wù)器的文件系統(tǒng)訪問的。

參見