Making php includes work in a sub-directory

后端 未结 4 1531
北海茫月
北海茫月 2020-12-29 12:57

Ok, I am creating an admin interface for my custom blog at the url /admin.

Is it possible for me to be able to use the same includes (including autoload), as the roo

4条回答
  •  伪装坚强ぢ
    2020-12-29 13:30

    Yet another answer would be similar to combining the first two suggestions. You could define the constant:

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

    Then, assuming that config.php needs to be included in many files of the site then you can use the following statement to accomplish this:

    include(ABSPATH.'config.php');
    

    Hope this helps.

提交回复
热议问题