global variables in php not working as expected

后端 未结 7 1811
被撕碎了的回忆
被撕碎了的回忆 2020-12-05 07:33

I\'m having trouble with global variables in php. I have a $screen var set in one file, which requires another file that calls an initSession() def

7条回答
  •  温柔的废话
    2020-12-05 07:50

    The global scope spans included and required files, you don't need to use the global keyword unless using the variable from within a function. You could try using the $GLOBALS array instead.

提交回复
热议问题