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
精彩评论