note 56654 added to function.symlink

From: Date: Sun, 11 Sep 2005 15:04:51 +0000
Subject: note 56654 added to function.symlink
Groups: php.notes 
Request: Send a blank email to php-notes+get-95010@lists.php.net to get a copy of this message
To make your code portable on unix AND win32, do the following 1. Download http://www.dynawell.com/reskit/microsoft/win2000/linkd.zip 2. Unzip, put linkd.exe in C:\Windows\System32 or C:\WINNT\System32 3. Include in your code the following <? function _syslink($t /*target*/ ,$l /*link*/ ) { if ($_SERVER["WINDIR"]) { $p=dirname($_SERVER["SCRIPT_FILENAME"])."/"; exec("linkd ".$p.$t." ".$p.$l); } else syslink($t,$l); } function _unlink($l /*link*/ ) { if ($_SERVER["WINDIR"]) { $p=dirname($_SERVER["SCRIPT_FILENAME"])."/"; exec("linkd ".$p.$l." /D"); } else unlink($l); } ?> 4. Enjoy _symlink(TARGET,LINK) works like symlink() on *nix _unlink(LINK) to delete properly the link created ---- Manual Page -- http://www.php.net/manual/en/function.symlink.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56654 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56654&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56654&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56654&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56654&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56654&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56654&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56654&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95010) next »