How can constants be defined once and reused through all files?

前端 未结 3 1697
谎友^
谎友^ 2021-01-16 06:58

I\'m trying to set up a site that has many reusable headers/footers, style information, etc. Is there anyway to define a global constant/function that can be reused from any

3条回答
  •  余生分开走
    2021-01-16 07:53

    I have been using:

    set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
    include_once('glob.php');
    

    Which sets my include path right at the root of my site. Not sure if it will work for you though, or if there is a better way?

提交回复
热议问题