嗯,廢話...這就是我對之前筆記要說的全部。 請刪除它。 :)
Windows Vista 現在有自己的符號連結程式 (mklink)。 希望未來 Windows 版的 PHP 會放入此功能?
無論如何,這將在 Vista 上運作(假設您的 PHP 使用者具有適當的權限)
<?php
define('SYMLINK_FILE', 0);
define('SYMLINK_DIR', 1);
define('SYMLINK_JUNCTION', 2);
function symlink ($target, $link, $flag = SYMLINK_FILE) {
switch ($flag) {
case SYMLINK_DIR: $pswitch = '/d'; break;
case SYMLINK_JUNCTION: $pswitch = '/j'; break;
case SYMLINK_FILE:
default: $pswitch = ''; break;
}
$target = str_replace('/', '\\', $target);
$link = str_replace('/', '\\', $link);
return exec('mklink ' . $pswitch . ' "' . $link . '" "' . $target . '"');
}
?>