How do you get PHP, Symlinks and __FILE__ to work together nicely?

前端 未结 6 1683
既然无缘
既然无缘 2020-12-02 15:19

On localhost. I have the following directory structure:

/share/www/trunk/wp-content/plugins/otherfolders

/share/www/portfolio/wp-content/s

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 16:15

    You can use this code snippet to get a path where symlinks are not resolved. If you don't have bash available, there's probably a different command you can use, but it works on linux enviroments.

    I do think it's a malpractice that php resolves symlinks in FILE, since there's no way to get the path with symlinks. Otherwise we could easily get it using realpath.

    Oh well.

    
    

提交回复
热议问题