PHP: let a file return its own directory

后端 未结 4 2211
盖世英雄少女心
盖世英雄少女心 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:46

    Use the magic constant __DIR__

    You can read more about the magic constants here: http://php.net/manual/en/language.constants.predefined.php

提交回复
热议问题