PHP: let a file return its own directory

后端 未结 4 2151
盖世英雄少女心
盖世英雄少女心 2021-01-25 19:06

I am having trouble finding the rigth directory on my online server. is there a function that returns the folder the file is stored in?

4条回答
  •  抹茶落季
    2021-01-25 19:51

    In PHP>=5.3 use __DIR__ and before use dirname(__FILE__)

    http://php.net/constants.predefined

    http://php.net/dirname

提交回复
热议问题