Home >Backend Development >PHP Tutorial >How python implements php's global variables
This article mainly shares with you how to implement global variables in php in python, I hope it can help you.
1 Implement the data structure GlobalMap
2 Data storage
from GlobalMap import GlobalMap as gmgm = gm() gm.set_map('hosts_up',hosts_up)
3 Data retrieval
from GlobalMap import GlobalMap as gmgm = gm() hosts_up = gm.map.get('hosts_up')
4 Use
to store the data in the html file Use the variable hosts_up
Note: Python's global variables are not the same as PHP's.
Related recommendations:
PHP basic notes function global variable_PHP tutorial
The above is the detailed content of How python implements php's global variables. For more information, please follow other related articles on the PHP Chinese website!