filetype() returns dir for symlinks on Windows 7

2019-08-29 18:49发布

问题:

Regardless of the filetype() documentation, PHP 5.4.7 returns "dir" on symlinks on Windows 7.

What's the most reliable way to detect a symlink on Windows 7?

回答1:

what does is_link() return in your case? maybe you can use that to test for links.

The provided link ( http://php.net/manual/en/function.is-link.php ) contains a workaround for Windows in the first comment. It's ugly, but I guess it does the job.