PHP absolute path to root

后端 未结 7 1888
轻奢々
轻奢々 2020-11-28 05:44

I can\'t believe PHP doesn\'t have an easy solution for this simple matter. ASP.NET has a ~ sign that takes care of this issue and starts everything from the root level. Her

相关标签:
7条回答
  • 2020-11-28 06:37

    In PHP there is a global variable containing various details related to the server. It's called $_SERVER. It contains also the root:

     $_SERVER['DOCUMENT_ROOT']
    

    The only problem is that the entries in this variable are provided by the web server and there is no guarantee that all web servers offer them.

    0 讨论(0)
提交回复
热议问题