Using require_once for up directory not working

前端 未结 1 1672
小鲜肉
小鲜肉 2020-12-29 02:23

I am using require_once like this

require_once(\'../mycode.php\')

I am developing a wordpress plugin. My plugin folder is yves-slider where

相关标签:
1条回答
  • 2020-12-29 03:07

    You want to make that relative to the current path the file is in:

    require_once __DIR__ . '/../yves-slider.php';
    

    What probably is happening is that the current path PHP looks in is not the path you think it is. If you are curious about what it is (the current path) you could do echo getcwd();.

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