How to get root dir on PHP

前端 未结 4 887
Happy的楠姐
Happy的楠姐 2021-02-13 00:44

I use realpath(\'../\'), it work fine but the result is D:wampwww ( real path is D://wamp/www ). Anybody can tell me how to get realpath by the right way? Thanks you verry much.

4条回答
  •  别那么骄傲
    2021-02-13 01:22

    You can put some php file into the root and get:

    $rootPath = dirname(__FILE__)
    

    inside it.

提交回复
热议问题