php 文件创建连接
$src = __DIR__.‘\upload‘;
$target = __DIR__.‘\backend\web\upload‘;
$res = exec("mklink /d ".$target." ".$src);
先目标的目录 后是源目录
Without any extra options, mklink
creates a symbolic link to a file. The below command creates a symbolic, or “soft”, link at Link
pointing to the file Target
:
mklink Link Target
Use /D when you want to create a soft link pointing to a directory. like so:
mklink /D Link Target
Use /H when you want to create a hard link pointing to a file:
mklink /H Link Target
Use /J to create a hard link pointing to a directory, also known as a directory junction:
mklink /J Link Target
来源:https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/