[英]Remove a symlink with PHP on Windows
How do I remove a symlink with PHP on windows? 如何在Windows上删除带有PHP的符号链接?
Running this: 运行这个:
mkdir('test');
symlink('test', 'test2');
unlink('test2');
Gives the following error: 给出以下错误:
PHP Warning: unlink(test2): Permission denied in C:\path\to\app\testlink.php on line 4
PHP Stack trace:
PHP 1. {main}() C:\path\to\app\testlink.php:0
PHP 2. unlink() C:\path\to\app\testlink.php:4
The directory and symlink were made correctly, just not removed. 目录和符号链接是正确的,只是没有删除。
Running: 运行:
Ok, I figured it out. 好的,我明白了。 So Ill leave this here for future reference: 所以我会留下这个以供将来参考:
To remove a symlink to a directory use the rmdir
function: 要删除目录的符号链接,请使用rmdir
函数:
mkdir('test');
symlink('test', 'test2');
rmdir('test2');
unlink
is for removing files. unlink
用于删除文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.