Home > Backend Development > PHP Tutorial > 何位大咖知道这段代码是做什么的

何位大咖知道这段代码是做什么的

WBOY
Release: 2016-06-13 12:52:07
Original
786 people have browsed it

哪位大咖知道这段代码是做什么的?
哪位大咖知道这段代码是做什么的?

<br />
        $superglobal = array(<br />
				'GLOBALS' => 1,<br />
				'_GET' => 1,<br />
				'_POST' => 1,<br />
						'_COOKIE' => 1,<br />
				'_SERVER' => 1,<br />
				 		'_FILES' => 1,<br />
		);<br />
		foreach($GLOBALS as $k=>$v) {<br />
			if(!isset($superglobal[$k])) {<br />
				$GLOBALS[$k] = null; unset($GLOBALS[$k]);<br />
			}<br />
		}
Copy after login

PHP
------解决方案--------------------
superglobal在这里当了一个过滤器

过滤掉global里面的一些变量,

执行后GLOBALS只保留GLOBALS,_GET_POST_COOKEI,_SERVER _FILES
------解决方案--------------------
删除全局变量,不包括在 $superglobal 中指定的
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template