Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

link

(PHP 3, PHP 4, PHP 5)

link -- Создаёт жёсткую ссылку

Описание

bool link ( string target, string link )

link() создаёт жесткую ссылку. Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.

Замечание: Эта функция не применима для работы с удаленными файлами, поскольку файл должен быть доступен через файловую систему сервера.

Замечание: Для Windows-платформ эта функция не реализована.

См. также описание функции symlink() для создания мягких ссылок, а также readlink() и linkinfo().



linkinfo> <lchown
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
link
stephane AT baladeauboutdumonde DOT com
06-Aug-2007 11:45
Make link recursively :
<?php
function makeRecusLink($orig, $dest)
{
    if (
is_dir($orig)) {
        if (
substr($orig, -1) != '/') {
           
$orig .= '/';
        }

       
$handle = opendir($orig);

        while (
false !== ($file = readdir($handle))) {
            if (
$file != '.' && $file != '..') {
               
$path = $orig.$file;

                if (
is_file($path)) {
                    @
link($path, $dest.'/'.$file);
                } else if (
is_dir($path)) {
                    @
mkdir($dest.'/'.$file, 0755);                   
                   
makeRecusLink($path, $dest.'/'.$file);
                }
            }
        }
    }
   
   
closedir($handle);
}
?>
root at c-works dot net
05-Jan-2007 01:58
Be aware that the filesystem of the target and the link must be the same, otherwise the link will fail! (Linking files over different filesystems doesn't work under Unix).
Jasper Bekkers
02-Aug-2006 07:16
For a backup utility I needed link-like functionality on a windows system. As it isn't availible on windows, i tried to do it myself with the help of some tools. All you need is junction.exe from sysinternals in your %PATH%.

<?php
if(!function_exists('link')){ // Assume a windows system
   
function link($target, $link){
        if(
is_dir($target)){
           
// junctions link to directories in windows
           
exec("junction $link $target", $lines, $val);
            return
0 == $val;
        }elseif(
is_file($target)){
           
// Hardlinks link to files in windows
           
exec("fsutil hardlink create $link $target", $lines, $val);
            return
0 == $val;
        }
       
        return
false;
    }
}
?>

http://www.sysinternals.com/Utilities/Junction.html
Guilherme Garnier
25-Apr-2006 11:32
I noticed that, differently from Unix ln command, the second parameter can
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571