include .php file in folder above

后端 未结 5 1196
既然无缘
既然无缘 2021-02-15 09:49

I am receiving this error

Warning: include(../config.php) [function.include]: failed to open stream: No such file or directory in /home/soizastu/public_html/cms/         


        
5条回答
  •  一整个雨季
    2021-02-15 10:22

    Just define the absolute path for the cms folder, in this case if the caller script (which you try to include the config.php) /home/soizastu/public_html/cms/happy-api/retrieve.php. Then write on top line of retrieve.php :

    define('ABSPATH',dirname(dirname(__FILE__)) . '/');

    and include the config.php by write :

    require(ABSPATH . 'config.php');

提交回复
热议问题