How can I find an application's base url?

后端 未结 11 1416
南方客
南方客 2020-12-16 01:35

I\'d like to find the base url of my application, so I can automatically reference other files in my application tree...

So given a file config.php in the base of my

11条回答
  •  无人及你
    2020-12-16 02:03

    If you want the path on the filesystem you can use $_SERVER['DOCUMENT_ROOT']
    If you just want the path of the file that appears in the URL after the domain use $_SERVER['REQUEST_URI']

提交回复
热议问题