开发者

Is there a way in PHP to check if a directory is a symlink?

I have symlinks to certain directories because the directories' names have non English characters that I got fed up trying to get apache's rewrite rules to match. There's a bounty on that question trouble with utf-8 chars & apache2 rewrite rules anyone wants to go for it, and from the looks of things a lot of people would like to see a general solution to this problem, but meanwhile I made a plain ascii symlink to each of these offending directories. Now the rewrite rules are back to just alpha and _ and - and my security concerns are less and it loads the resources I want. But I still need the actual target di开发者_StackOverflowrectory name for display purposes. I googled "PHP directory info, PHP symlink" but didn't find anything. I need to do something like this:

if (is_symlink($myResDirName)) {
    $realDirName = follow_symlink($myResDirName);
}


You're looking for is_link


http://www.php.net/manual/en/function.is-link.php and http://www.php.net/manual/en/function.readlink.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜