Best way to include file in PHP?

前端 未结 2 1590
醉话见心
醉话见心 2021-01-01 02:45

I\'m currently developping a PHP web application and I would like to know what is the best manner to include files (include_once) in a way where the code it is still maintan

2条回答
  •  -上瘾入骨i
    2021-01-01 03:20

    I used to start all my php file with:

    include_once('init.php');
    

    Then in that file I would require_once all the other files that needed to be required, like functions.php for example, or globals.php where I would declare all global variables, or constants. That way you only have to edit all your setting at one place.

提交回复
热议问题