Jump to: navigation, search

Php link

From w3cyberlearnings

Contents

PHP function link

This function creates a hard link.

Syntax link

  • target is the already existed file
  • link is the hard link to be created
link(target, link);

Note

  • For Windows only: This function requires PHP to run in an elevated mode or with the UAC disabled.
  • Support in windows vista, server 2008 or greater platform.
  • Hard link can not go across different filesystems.
  • The file system of both arguments have to be the same.

Example 1

<?php 
  $target = '/var/www/read.php';
  $link ='/var/www/read222.pp';
  
  link($target, $link);
?>

Output

-rw-r--r-- 2 root root   43 2012-06-08 11:09 read222.pp
-rw-r--r-- 2 root root   43 2012-06-08 11:09 read.php

Example 2

link ("/dir1/file", "/dir2/");       // incorrect, gives a "File exists" warning
link ("/dir1/file", "/dir2/file");   // correct, creates /dir2/file link

Related Links


basename-- chgrp-- chmod-- chown-- clearstatcache-- copy-- delete-- dirname-- disk_free_space-- disk_total_space-- diskfreespace-- fclose-- feof-- fflush-- fgetc-- fgetcsv-- fgets-- fgetss-- file_exists-- file_get_contents-- file_put_contents- file-- fileatime-- filectime-- filegroup-- fileinode-- filemtime-- fileowner-- fileperms-- filesize-- filetype-- flock-- fnmatch-- fopen-- fpassthru-- fputcsv-- fputs-- fread-- fscanf-- fseek-- fstat-- ftell-- ftruncate-- fwrite-- glob-- is_dir-- is_executable-- is_file-- is_link-- is_readable-- is_uploaded_file-- is_writable-- is_writeable-- lchgrp-- lchown-- link-- linkinfo-- lstat-- mkdir-- move_uploaded_file-- parse_ini_file-- parse_ini_string-- pathinfo-- pclose-- popen-- readfile-- readlink-- realpath_cache_get-- realpath_cache_size-- realpath-- rename-- rewind-- rmdir-- set_file_buffer-- stat-- symlink-- tempnam-- tmpfile-- touch-- umask-- unlink--

Navigation
Web
SQL
MISC
References