Declaring global variable with php.ini

后端 未结 8 1834
死守一世寂寞
死守一世寂寞 2020-12-03 21:12

Is it possible to keep variables in php.ini file. Like that we do with the web.config in .net. I like to keep a flag type variable in the php.ini and use it to different pro

相关标签:
8条回答
  • 2020-12-03 22:07

    Have you looked at get_cfg_var()?

    I needed to do something similar, and this was able to do it for me.

    0 讨论(0)
  • 2020-12-03 22:07

    Nope.

    You could use the auto_prepend_file directive to automatically include a file that said, although as it uses the include_path, you'd need to specify the full path.

    However, it's probably more transparent just to explicitly include/require the relevant file.

    0 讨论(0)
提交回复
热议问题