Home >Backend Development >PHP Tutorial >How python implements php's global variables

How python implements php's global variables

小云云
小云云Original
2018-03-31 11:15:081434browse


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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn