require_once to global scope within a function

前端 未结 4 1682
情话喂你
情话喂你 2021-01-11 13:47

It seems that if require_once is called within function, the included file doesn\'t extend the global variable scope. How to require_once a

4条回答
  •  我在风中等你
    2021-01-11 14:43

    To summarize all the information:

    1. functions are not an issue, they will be global anyway this way

    2. for global variables, there are 2 options:

      • declare them as global in the included file
      • declare them as global in that function (projects_init() in my case)

提交回复
热议问题